Find The Error(s); funny;


who can find the Errors in this statments ;

1-
1
2
3
4
Assume that: char str[ 5 ];

cin >> str; // user types "hello"


2-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
int *zPtr;        // zPtr will reference array z
int *aPtr = 0;
void *sPtr = 0;
int number;
int z[ 5 ] = { 1, 2, 3, 4, 5 };



++zPtr;


// use pointer to get first value of array
number = zPtr;



// assign array element 2 (the value 3) to number
number = *zPtr[ 2 ];



// print entire array z
for ( int i = 0; i <= 5; i++ )
   cout << zPtr[ i ] << endl;



// assign the value pointed to by sPtr to number
number = *sPtr;


++z;


char s[ 10 ];
cout << strncpy( s, "hello", 5 ) << endl;



char s[ 12 ];
strcpy( s, "Welcome Home");



if ( strcmp( string1, string2 ) )
   cout << "The strings are equal" << endl;





... waiting ...
http://www.cplusplus.com/forum/articles/1295/
We don't do peoples homework for them.
I SWEAR IT IS NOT A HOMWORK ,,, I have Final EXAM ,, but I can't understand this 2 Q ...


I NEED HELP ,, for FINAL EXAM ,,
homework, exam is same thing. We are not here to give you answers for your study. We are here to assist when you have legit programming problems.

I've looked back at your posts. Most of them have been blatent requests the same as this for answers. You've shown very little to no effort in trying to solve these problems yourself. Why should we give you the answers?

If you cont posting in this fashion, I'll make a recommendation to have your account removed.
Why should we give you the answers?


it is problem .. what is the diffrent between my Q and legit programming problems?

and I challenge u .. if u can find an error in #1;

qhen look at it u will understand why I ask ..
Also, do you even understand the difference between , . ! and ?...? Because it doesn't look that way...
it is problem .. what is the diffrent between my Q and legit programming problems?

Most people with legitimate problems will post the work they've done so far. They'll highlight an error in the code and the compiler message corresponding to it. From there we can read the compiler problem, or read their description of the problem, and come to a viable solution for them to try. They actually make some form of effort to solve the problem themselves first.

and I challenge u .. if u can find an error in #1;

Alot of the people who provide advice on these forums are professional developers. We've seen all the silly little assignment problems many times before so they are easily recognised by us. They also provide little to no challenge as the tasks are so trivial to solve.

qhen look at it u will understand why I ask ..

As I've just said. Such questions are very trivial to solve for professional developers. I myself can see 4 things I'd change in Q1 to make the code more robust, that'd depend obviously of the constraints on your assignment, as in a professional application I'd re-write it completely.

We are not here to solve your homework/assignment/exam questions for you though. We are here to help you solve them once you've made a viable effort to work through them.

So all n all. How about you try to solve them yourself first. We only help those who help themselves.
Topic archived. No new replies allowed.