#include <stdio.h>
int main(){
char a[5];
for(char i = 0, i < 5, ++i){
scanf("%c", &a[i]);
}
printf("%c", a[5]);
return 0;
}
I changed a[5] into a[i] in the printf, nothing changed. I have compared with this one i found on the net(which works ofc):
int main() {
int values[5];
for(int i = 0; i < 5; ++i) {
scanf("%d", &values[i]);
}
for(int i = 0; i < 5; ++i) {
printf("%d\n", values[i]);
}
return 0;
}
You are using ,
instead of semi colon ;
in the for loop.
for(char i = 0, i < 5, ++i)
Correct Usage:
for(char i = 0; i < 5; ++i)