0
I don't know why if how known pls tell me
#include <stdio.h> int main(){ int sam[3],i; sam[1] = 5; sam[2] = 5; sam[3] = 6; for (i=0;i<3;i++){ printf("%d\n",sam[i]); } } (unexpected)the answer is 4200656 5 5 (expect) 5 5 6
2 Antworten
+ 3
An array is zero-index. So it start counting by 0.
int main()
{
int sam[3],i;
sam[0] = 5;
sam[1] = 5;
sam[2] = 6;
for (i=0;i<3;i++)
{
printf("%d\n",sam[i]);
}
}
you'll be fine
0
thank you so mush @sneeze