0
Can i knw why is an error appearing here..even though output is received
5 Answers
+ 4
it should be scanf("%s", x);
+ 2
In scanf we specify address as a second parameter. For if x[], is an array, the variable x points to first Location.
First parameter %s, means take word so read chars until space encounters..
For more clarification see this,..
https://code.sololearn.com/cLRi914Y81vC/?ref=app
+ 1
&x means address of x. Input stored at the address of specified location by &x.
Primitive values required to store at corresponding variable addresses so we specify &x but in your program x is char array. In c, if omit [], it points address of 0th location. So while dealing with char Arrays you don't need to put &, it is already pointing to first element of array address...
Array means continuous memory locations os same type.
0
ā³AsterisKā³ so..here '&' isnt used...why?
0
Jayakrishna so just by pointing to the first element of array address..the whole collection of characters can be stored?