I have to scan a string with spaces so I can do somethings with it in this case moving the string n chars to the right or to the left. For example:
If I give n = 1, the string
house
becomes:
ehous
But the input can also be a string with spaces like, n being the same:
yellow house
becomes:
eyellow hous
So to scan the string im doing this:
char text[166];
scanf("%d %[^\n]%*c", &n, &text);
And everything works great, but now the I submitted the program I get this error:
src.c: In function 'main':
src.c:30:26: error: format '%[^
' expects argument of type 'char *', but argument 3 has type 'char (*)[166]' [-Werror=format=]
30 | scanf("%d %[^\n]%*c", &nVezes, &texto);
| ~~~^~ ~~~~~~
| | |
| char * char (*)[166]
What can I solve this? Also I can't use these libraries string.h, strings.h, and stdlib.h.
Every bit of help is appreciated.