How to create a string-type variable in C

后端 未结 8 1374
没有蜡笔的小新
没有蜡笔的小新 2021-02-04 08:42

Question

How to declare a string variable in C?

Background

In my quest to learn the basics of c, I am trying to port on

8条回答
  •  迷失自我
    2021-02-04 09:11

    replace int name; to--. char name[60];

    #include 
    int main()
    {
      char name[648];
      printf("What is your name?");
    
      scanf("%s", name);
      printf("Your name is %s", name );
    
      return 0;
    }
    

提交回复
热议问题