Using %s in C correctly - very basic level

后端 未结 5 956
庸人自扰
庸人自扰 2020-12-10 05:09

I know that %s is a string of characters, but I don\'t know how to use it. Can anyone provide me a very basic example of how its used and how its different from char ?

5条回答
  •  半阙折子戏
    2020-12-10 05:18

    Here goes:

    char str[] = "This is the end";
    char input[100];
    
    printf("%s\n", str);
    printf("%c\n", *str);
    
    scanf("%99s", input);
    

提交回复
热议问题