write a program to display the array elements in reverse
order in c language
Answer Posted / pandia
#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 ? | 33 Yes | 28 No |
Post New Answer View All Answers
Can you subtract pointers from each other? Why would you?
What is a good data structure to use for storing lines of text?
Why dont c comments nest?
main() { printf("hello"); fork(); }
int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above
What is the correct declaration of main?
What is meant by errors and debugging?
What are run-time errors?
What are nested functions in c?
Explain what happens if you free a pointer twice?
why we wont use '&' sing in aceesing the string using scanf
write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.
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 ].
What is difference between array and structure in c?
Explain how can you avoid including a header more than once?