You are viewing a single comment's thread. Return to all comments →
void RevArray(int *ptr,int iSize){
int iCnt = 0; int Temp = 0; int i = iSize - 1; while(iCnt < i) { Temp = ptr[iCnt]; ptr[iCnt] = ptr[i]; ptr[i] = Temp; i--; iCnt++; }
}
int main(){
int *Arr = NULL; int iLength = 0,iCnt = 0; scanf("%d",&iLength); Arr = (int *)malloc(sizeof(int) * iLength); for(iCnt = 0; iCnt < iLength; iCnt++) { scanf("%d",&Arr[iCnt]); } RevArray(Arr,iLength); for(iCnt = 0; iCnt < iLength; iCnt++) { printf("%d ",Arr[iCnt]); } return 0;
Seems like cookies are disabled on this browser, please enable them to open this website
Array Reversal
You are viewing a single comment's thread. Return to all comments →
include
include
void RevArray(int *ptr,int iSize){
}
int main(){
}