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...

write a program to display the array elements in reverse
order in c language

Answer Posted / arpit dhandhania

Both the solution above is wrong...

Answer #1: It will input an extra element in array coz array is starting from 0 and goes till n so total elements n+1

Answer #2: C Automatically starts array from 0 index and not 1 if not programmed otherwise and in the given program we are starting the loop from 1

Solution

void main()
{
int a[30],n;
scanf("%d",&n);

for(int i=0;i<n;i++)
scanf("%d",&a[i]);

for(i=n-1;i>=0;i--)
printf("%d",a[i]);

}
}

Is This Answer Correct ?    65 Yes 39 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is int main () in c?

1031


How pointer is different from array?

1020


How will you divide two numbers in a MACRO?

1084


What are header files in c programming?

1077


write a c programming using command line argument,demonstrate set operation(eg;union,intersection,difference) example output is c:>setop 12 34 45 1 union 34 42 66 c:>setop 12 34 1 42 66 c:>setop 12 34 diff 12 56 67 78 setop 12 34

2111


Write a program on swapping (100, 50)

1068


How can I invoke another program or command and trap its output?

1049


Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?

3459


Explain what does it mean when a pointer is used in an if statement?

1006


Why array is used in c?

975


What is %d called in c?

1185


What are integer variable, floating-point variable and character variable?

1185


Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.

1359


Can i use “int” data type to store the value 32768? Why?

1146


What is use of bit field?

1237