+ 1

What the compiler errors? What does it mean?

The program is output right answer, but the compiler is going errors: #include <stdio.h> int main() { char* str="Grr"; str="Lion"; scanf("%s\n"); printf("%s\n", str); return 0; }

4th Oct 2020, 8:12 PM
Vladimir Kushner
Vladimir Kushner - avatar
5 ответов
+ 5
Clear @Martin Tylor thanks.Then you have to declare char pointer to store the input from the user ,then this char pointer will be the argument for scanf char *string[100]; scanf("%s",string);
4th Oct 2020, 8:54 PM
HBhZ_C
HBhZ_C - avatar
+ 2
Here scanf is without argument?
4th Oct 2020, 8:15 PM
HBhZ_C
HBhZ_C - avatar
+ 2
It turns out - yes
4th Oct 2020, 8:17 PM
Vladimir Kushner
Vladimir Kushner - avatar
+ 1
Which arguments will be correct then?
4th Oct 2020, 8:21 PM
Vladimir Kushner
Vladimir Kushner - avatar
0
The input will be given by the user you don't know what is the string that will be given in each case you are tested for.So i think scanf is not the good function to use for string or array of char in c.
4th Oct 2020, 8:26 PM
HBhZ_C
HBhZ_C - avatar