Answer:
#include <iostream>
using namespace std;
int * reverse(int a[],int n)//function to reverse the array.
{
int i;
for(i=0;i<n/2;i++)
{
int temp=a[i];
a[i]=a[n-i-1];
a[n-i-1]=temp;
}
return a;//return pointer to the array.
}
int main() {
int array[50],* arr,N;//declaring three variables.
cin>>N;//taking input of size..
if(N>50||N<0)//if size greater than 50 or less than 0 then terminating the program..
return 0;
for(int i=0;i<N;i++)
{
cin>>array[i];//prompting array elements..
}
arr=reverse(array,N);//function call.
for(int i=0;i<N;i++)
cout<<arr[i]<<endl;//printing reversed array..
cout<<endl;
return 0;
}
Output:-
5
4 5 6 7 8
8
7
6
5
4
Explanation:
I have created a function reverse which reverses the array and returns pointer to an array.I have also considered edge cases where the function terminates if the value of the N(size) is greater than 50 or less than 0.
Answer:
I believe import math.
Do let me know if its correct.
No, this website is not for study groups. It's more of a 'question and answer' website. There is no actual communication on one certain subject. Although I do know a few websites that have worked really well for me,where you can create and participate in study groups;
-studyblue
- studyhall
- getstudyroom
all of these are safe websites that are used by wide variety of students, therefore i'm sure you can find plenty of people interested in learning the same things as you!
In C++, 'Try block' comprises of a group of statements in which there is a probability of an exception to take place.
C). The statements that would be left in the try block in case a particular statement leads to an exception 'can't be executed.'
- In case an exception takes place, the left statements in the try block fail to function.
- This is the primary reason for which a catch block immediately succeeds a try block in order to deal with the exception and help close that code to allow the statements to work.
- Thus, <u>option C</u> is the correct answer.
Learn more about 'Try block' here:
brainly.com/question/14186450
Developing in the cloud enables users to get their applications to market quickly. Hardware failures do not result in data loss because of networked backups. Cloud computing uses remote resources, saving organizations the cost of servers and other equipment.