i want to write a program that prints the value in array which are at odd position, i've this for single dimensional array but confused about 2-D array.
Single dimensional:
int main(void)
{
int num[10];
int i;
for (i=0;i<10;i++)
{
printf ("Enter %d value: ",i);
scanf ("%d",&num[i]);
}
for (i=0;i<10;i=i+2)
printf ("%d ",num[i]);
getche ();
}
2 Dimensional effort:
int main(void)
{
int num[10][2];
int i;
for (i=0;i<10;i++)
{
for (j=0;j<2;i++)
{
printf ("Enter %d value: ",i);
scanf ("%d",&num[i][j]);
}
for (i=0;i<10;i=i+2)
{
for (j=0;j<2;j=j+2)
printf ("%d ",num[i][j]);
}
getche ();
}
this incrementation not working for j loop for (j=0;j<2;j=j+2)