| |
GeekInterview.com > Placement Papers > CSC
| Print | |
Question: char str[10]; int i; for(i=0;i<=9;i++) scanf("%s",&str[i]); for(i=0;i<=9;i++) printf("%c",str[i]); What will be the difference if we use %c instead of %s in scanf, give reason also
|
| February 02, 2009 03:48:54 |
#2 |
| kapildeverampu |
Member Since: February 2009 Total Comments: 1 |
RE: char str[10];int i;for(i=0;i |
If you use scanf("%s",&str[i]); then you can input 10 names like ravi, rama, kapil ..etc. But only the first letter of each names will be stored It you use scanf("%c",&str[i]); then you will be able to input only 10 characters. |
| |
Back To Question | |