Results 1 to 3 of 3
i'm a newbie ,i don't know where problems
未命名.jpg
The results
未命1名.jpg...
- 01-31-2012 #1
- 01-31-2012 #2
You've got an extra & on line 6 that you shouldn't have.
ss is declared as an array, so you want to pass the beginning of the array to the scanf() function. This is similar to the line below where you are printing out the array.
- 01-31-2012 #3
You have a pointer-type problem.
First, a little background... If you define an array:
you generate a variable ('array') which acts as a pointer to the block of memory you allocated in the declaration. You can then do stuff like:Code:char array[20];
and now 'pointer' points at the same block of memory.Code:char* pointer =0; pointer = array;
So, if your method is calling for a 'char' pointer (i.e. a 'char *') then you just need to pass it the name of your array. In my examples from above, both these would be valid:
Code:scanf("%s", array); scanf("%s", pointer);Linux user #126863 - see http://linuxcounter.net/


Reply With Quote