+ 5
How can print an array from the end to the start?
Suppose I have the array a[4]={3,1,2,5} how can I make it print 5213?
5 Answers
+ 15
run a loop from n=no. of elements in array-1 to n=0
//where n correspnds to index value of an element in array
+ 3
I have updated my code for you @Abubakr. Now you can find the terms of any array and can reverse it.
+ 2
What if I don't know the number of elements in the array? I heard vectors can help me but I don't know how to use them as I still didn't reach them in the course.
0
thanks @Akash!! but I didn't understand the (sizeof(myArr)/sizeof(myArr[0]))-1 part.
Shouldn't x=sizeof (myArr) be enough?