Problem occur in initializing values of array?

#include <stdio.h>

int main(void) {
	// your code goes here
	int arr[10],k=0,test=6;
	while(test>0){
	    arr[k]=test;
	    k++;
	    test--;
	    printf("%d ",arr[k]);
	}
	return 0;
}

Output
0 -6269075 11015 0 0 0

Track your value of k.

Is your print line in the correct location to get the value you actually want?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.