I've been practicing how to use vectors in c, and I've run into several simple programs that I've done with "junk" values, for example in the following code that consists of the user typing their full name, including spaces:
int main()
{
int nombre,i=0;
char s[20];
printf("introdusca su nombre\n");
while ((nombre = getchar()) != '\n')
{
s[i] = nombre;
i++;
}
printf("%s\n", s);
}
when executing the program, if it manages to print the name including the spaces, but the problem is that many signs like these are added ╗┐ followed by the printed name, I do not know what the problem is, like when I use arrays but Instead of characters are numbers, something similar happens to me, but instead of ╗┐, I get extremely large numbers instead of the ones I type.