A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write C++ program to print the elements of the array in reverse order using a pointer
Q:

Write C++ program to print the elements of the array in reverse order using a pointer

0

Write C++ program to print the elements of the array in reverse order using a pointer

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

I have used CodeBlocks compiler for debugging purpose. But you can use any C++ programming language compiler as per your availability.

#include <iostream>
using namespace std;
 
int main() {
 
   int arr[5],i;
     int *p=arr;
     cout<<"Enter five numbers separated by space:";
     cin>>*p>>*(p+1)>>*(p+2)>>*(p+3)>>*(p+4);
     cout<<"Your entered numbers in reverse order are:\n";
     for(i=4;i>=0;i--)
        cout<<*(p+i)<<endl;
 
 
     return 0;
 
}

Result:

Enter five numbers separated by space:1 2 3 4 5

Your entered numbers in reverse order are:

5

4

3

2

1

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now