Ask coding questions

← Back to all posts
I dont know what i do
ManoelWeber (0)

If i use a scanf("%s",string[i]) inside for(i=0;i<n<i++). The spaces I use is writed in the string or not?

mwilki7 (1134)

scanf("%s", string[i]) won't work because scanf("%s"...) writes to 1-D arrays
string IS a 1-D array, but giving string an index:


references a char and not a string

scanf("%s", string) will work

but I don't know if that's what you want your program to do. If this doesn't fix it I may need a description of the repl.


What on earth is your program meant to do? It is not at all obvious from looking at your code. Please be precise.