Char str[10];int i;for(i=0;i

Showing Answers 1 - 2 of 2 Answers

With %s it will take 9 name or words but prints only starting alphabets...and with %c it will take characters and prints 9 characters which have entered....

for eg:-

with %s it can take hello,going,sitting etc till 9 words but prints h,g,s i.e starting letter

with %c it will take hello and going as characters i.e it will consider each letter of hello and going as a independent unit and prints hellogoing as sitting will be out of it memory size

  Was this answer useful?  Yes

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.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions