how to print 2-D array using a single for loop?
Answer Posted / tknowledge05
#include<stdio.h>
#include<conio.h>
void main()
{
int a[3][3]={2,4,5,7,2,9,2,3,2};
int f=0,i;
printf("\n");
for(i=0;f!=3;i++)
{
if(i==3)
{f++;
printf("\n");
i=0;
}
printf("%d ",a[f][i]);
}
getch();
}
| Is This Answer Correct ? | 21 Yes | 4 No |
Post New Answer View All Answers
The statement, int(*x[]) () what does in indicate?
Is null valid for pointers to functions?
What is hash table in c?
How can I read in an object file and jump to locations in it?
what are enumerations in C
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
What is ponter?
Can true be a variable name in c?
What does the error 'Null Pointer Assignment' mean and what causes this error?
How main function is called in c?
What is your stream meaning?
Is it possible to initialize a variable at the time it was declared?
What is the meaning of ?
How do we declare variables in c?
What are data structures in c and how to use them?