answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

// note: this code does not test for user-input errors!!

int main() {

int array[10],i,n;

printf("enter the number of elements in the array:");

scanf("%d",&n);

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

printf("the reverse ordered array is :");

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

return 0;

}

User Avatar

Wiki User

6y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

01 #include 02#include

03#include

04

05 int main()

06{

07 int *ptr,i,n;

08 clrscr();

09 printf("Enter the no of elements:");

10 scanf("%d",&n);

11 ptr=(int *)malloc(sizeof(int)*n);

12 if(ptr==NULL)

13 {

14 printf("Not enough memory");

15 exit(1);

16 }

17 for(i=0; i

18 {

19 printf("Enter %d element : ",i+1);

20 scanf("%d",&ptr[i]);

21 }

22 printf("Array in original order\n");

23 for(i=0; i

24 {

25 printf("%d\n",ptr[i]);

26 }

27 printf("Array in reverse order\n");

28 for(i=n-1; i>=0; i--)

29 {

30 printf("%d\n",ptr[i]);

31 }

32 getch();

33 return 0;

34 }

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

#include #include #define MAX 30 void main() { int size,i,arr[MAX]; int *ptr; clrscr(); ptr=&arr[0]; printf("Enter the size of array : "); scanf("%d",&size); printf("nEnter %d integers into array:n",size); for(i=0;ifor(i=size-1;i>=0;i--) { printf("nElement%d is %d :",i,*ptr); ptr--; } getch(); }

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

Get the Array Elements. Create another array. Using loops, copy the values reversely.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program to read an array and print its reverse using pointers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

C program to read an array and print its reverse number using pointers?

#include&lt;stdio.h&gt; void main() { int *p,n,s=0; printf("Enter Number :"); scanf("%d",&amp;n); for(p=&amp;n;*p&gt;0;p++) { s=s*10+*p%10; *p=*p/10; } printf("Reverse Number=%d",s); }


Program to print all the even numbers of an array in visual basic?

find even number in array


Write a java program to print the result in the series?

If you have the series stored in an array, you loop through the array and print each array element in turn. Another possibility is to print out the numbers in the series as you generate them. In that case, you may not need to store anything (depending on the series, of course).


Print array in reverse order vb6?

Well maybe you can make another form show() but make its opacity 0 so people wont know the secret behind it, no the other form, make it display the array backwards and use the print dialog to print the hidden form.


Write a c program to find the maximum of two numbers and print out with its position?

maxValue = function (array) {mxm = array[0];for (i=0; i&lt;array.length; i++) {if (array[i]&gt;mxm) {mxm = array[i];}}return mxm;}; i don't know


Write a program to reverse the given string?

Use for loop declare string array str[] and string variable l= string length of string array j=l for i=0 to i=l/2 then temp=str[i] str[i]=str[j-1] str[j-1]=temp j=j-1 now print str array it will be reversed


You want to write a simple without using pointer or array c program which will print greatest number when you give 20 number?

i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?


Program to print sorting of an array in clanguage?

/* PROGRAM TO SORT ARRAY ELEMENTS USING BUBBLE SORT*/ #include #include void main() { int i,j,n,t,a[50]; clrscr(); printf("ENTER THE ARRAY SIZE:\n"); scanf("%d",&amp;n); printf("ENTER THE ARRAY ELEMENTS:\n"); for(i=0;i


How do you write a program which reads a list of ten numbers and print the list in reserve order in c program?

The simplest way is probably to read the numbers into an array and then prints each element of the array starting at the last one and moving backwards.


How to print the reverse of an array without using backward loop?

int youArray[arraysize] = {...};...for (int i = 1; i


How to write a program in python to print the reverse of a number?

In python, type the following into a document. NOTE: Sentences following a # symbol are comments, and are not necessary for the program to run. #!/usr/bin/python #This program takes a input from a user and reverses it. number = input("Type a number: ") #This takes input from a user. a = len(number) #This finds the length of the number reverse = "" #This sets the variable reverse to an empty string. for i in number: a = a-1 #The places in a string start from 0. The last value will be the length minus 1.reverse = reverse + number[a] #Makes the number's last digit the new string's first. print("The reverse of", number, "is", reverse + ".") #prints the resulting string. This program will take any sequence of characters and reverse them. The final value is a string, but if an integer is needed, one needs only to add the line reverse = int(reverse) above the print statement. However, this will stop the program from being able to reverse strings, as it is not possible to convert a string to an integer if it is not a number.


Write a program that asks the user to type two integers A and B and exchange the value of A and B?

// While this doesn't prompt the user for input, it does reverse the values' contents. $intA = '10'; $intB = '20'; $tmp = $intA; $intB = $intA; $intA = $tmp; print $intA; // 20 print $intB; // 10 // An even quicker way is... list($b,$a) = array($a,$b);