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

Answer Posted / dally

#include<stdio.h>
int main()
{
int a[]={1,2,3,7,8};
int count=0,i;
while(a[i] != '\0')
{
count++;
}
for(i=count;i>=1;i--)
{
printf("%d",a[i]);
}
}

Is This Answer Correct ?    52 Yes 48 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the condition that is applied with ?: Operator?

654


What is data type long in c?

615


What are extern variables in c?

538


Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.

3681


Explain can static variables be declared in a header file?

668






Iam a B.Tech graduate and completed my engineering in 2009, from 2005 to 2009 and after that i had done nothing.Now i want to do job and get into BPO field . Friends give me suggestions as what to say in interview... if they ask me that what would you had done ... these many years without doing job ??????? pls urgent

1421


write a program to find the given number is prime or not

3824


What is difference between structure and union with example?

584


What is a char in c?

548


Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].

631


What are the types of type specifiers?

615


C program to find all possible outcomes of a dice?

1843


write a program in C that prompts the user for today's date,tomorrow's date and display the results.Use structures for today's date,tomorrow's date and an array to hold the days for each month of the year.

4973


What are the complete rules for header file searching?

660


What are the advantages of union?

619