Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to print 2-D array using a single for loop?

Answer Posted / vinay joshi

void main()
{
int i,j=-1;
int a[3][2];

label:j++;
for(i=0;i<2;i++)
{

if(j>3)
{
//printf("%d",j);
break;
}
printf("enter the element:");
scanf("%d",&a[j][i]);
if(i==1 )
{
goto label;
}

}
j=-1;

label2:++j; printf("\n");
for(i=0;i<2;i++)
{
if(j>3)
{
break;
}
printf("%d\t",a[j][i]);
if(i==1)
{
goto label2;
}

}
getch();
}

Is This Answer Correct ?    1 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is class and object in c?

1047


please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code

2131


What kind of structure is a house?

994


what type of questions arrive in interview over c programming?

1982


Which are low level languages?

1046


What are the 4 types of unions?

988


What are c identifiers?

1039


How reliable are floating-point comparisons?

1035


What is c mainly used for?

1000


What is the use of pragma in embedded c?

1004


a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above

1070


How can I get the current date or time of day in a c program?

1166


What is the difference between procedural and functional programming?

1009


Are pointers integers in c?

1029


How can I read/write structures from/to data files?

924