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:

a.exe has stopped working

any appreciated.

printf("%s\n", i); 

that tries print string. i integer. crash when dereferences i string.

try

printf("%d\n", i); 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -