You are here:

C/data Structures

Advertisement


Question
Why "&" is not required while reading a character array with "%s" specifier?

Answer
Hello Goraksh.

The & is not required because with %s you are reading the characters into an array. An array automatically evaluates to an address.

For example:

char str[123];
scanf("%s", str);

The str is automatically passed to scanf as the address of the start of the array.

Best regards
Zlatko

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Zlatko

Expertise

No longer taking questions.

Experience

No longer taking questions.

Education/Credentials
No longer taking questions.

©2012 About.com, a part of The New York Times Company. All rights reserved.