Also on the input string C language and characters

scanf()
char name1[11], name2[11];
int count;
printf("\nPlease write down 2 names...\n");
count=scanf("%5s %6s",name1,name2);
printf("\nname1:%s\nname2:%s",name1,name2);
scanf () allows you to specify the length of the input string format. If the above program input "liujiajia liujiajia", the program will output "name1: liuji name2: liujia";

Reproduced in: https: //my.oschina.net/itfanr/blog/195636

Guess you like

Origin blog.csdn.net/weixin_33841503/article/details/91799332