I'd like to create and manipulate an array of caracters. I don't want to use strings. here is my code in C language :
int main(int argc, char *argv[]) {
char s[4];
int i;
for(i = 0; i < 4; i++){
printf("Character at %d : ",i);
scanf("%c",&s[i]);
printf("%c",s[i]);
}
return 0;
}
When I execute it, it seems that :
- The compiler jumps from an element at
i
in the array to the element ati+2
- Nothing is added in the array. the array stays empty
I'd like to understand what's wrong with the scanf("%c",&s[i]);
that I think it is that instruction wich causes the problems in this code.