Comparison between pointer and integer in C

后端 未结 8 1309
盖世英雄少女心
盖世英雄少女心 2021-01-05 06:00

I have a bit stupid question about program in C. My compiler says me: warning: comparison between pointer and integer. I really don\'t know why. I only want to writ

8条回答
  •  花落未央
    2021-01-05 06:12

    please write your code like this

    int i = 0; 
    char str[50] = {'s', 'a', 'm', 'p','l','e'}; //only for test 
    while (str[i] != "\0") { 
    putchar(str[i]); 
    i++; 
    } 
    

提交回复
热议问题