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

后端 未结 7 472
野趣味
野趣味 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 10:58

    char st is a character i.e it will store only one character try it like this main() char st [100]; scanf("%s",st); just change these three lines and it will work it will except only single word strings here you have declared the function as an int that is int main() keep it as main() and it will work

提交回复
热议问题