Wednesday 18 September 2013

Printing arrays in C

Printing arrays in C

Alright I'm just now picking up c so I'm pretty terrible since I'm comin
from basic python. The question is I'm trying to print the number in an
array, I'm using a for loop but its not coming out the right way. #include
#include int main() { int array[]={0,1,2,3,4}; int i; for (i=0;i<5;i++); {
printf("%d",array[i]); } printf("\n"); }
My out put is 134513952
I have no clue why it's printing this

No comments:

Post a Comment