c code: for loop compiles with gcc but doesn't run -
i'm new c programming. i'm trying print numbers 1 10.
#include <stdio.h> int main(){ int i; for(i=1; i<11; i++){ printf("%s\n", i); } getchar(); }
it compiles in powershell when type: gcc .\forloop.c
when try run program ./a
error message:
any appreciated.
printf("%s\n", i);
that tries print string. i
integer. crash when dereferences i
string.
try
printf("%d\n", i);