format '%s' expects argument of type 'char *'

后端 未结 7 474
野趣味
野趣味 2021-01-11 10:32
#include 
int main(void)
{
    int i,j,k;
    char st;
    printf(\"enter string\\n\");
    scanf(\"%s\", st);         


        
相关标签:
7条回答
  • 2021-01-11 11:09

    scanf needs a pointer to char* to indicate you are scanning a string.

    You are supplying a character that's allocated on the stack.

    You either want to use a getchar() or make st a char array.

    0 讨论(0)
提交回复
热议问题