while scanning string we won't use ambers '&' why??
The compiler will generate a pointer to the first character of a character array if all you pass is the array name, The & symbol is optional. If you want a pointer somewhere else in the array then you have to use the & operator and tell it which byte you want the pointer to start.
The above line is the same as this one:
In case of arrays the name of the array itself behaves as the pointer, like:
if declaration is int array;
array = address of first element
&array = address of first element
&array = address of whole array
But what will happen if you declare a function that has an argument whose type is an array type — like this:
void function(int array);
The answer might suprise us...
The compiler looks at that and thinks, that it is going to be a pointer when the function is called and then rewrites the parameter type to be a pointer.
As a result, all the following three types of these declarations are identical:
void function(int array); void function(int *array); void function(int array); /* since the size of the array is irrelevant! */
Thats why programming is so interesting if you understand the insights...;)