We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
intnum,*arr,i;scanf("%d",&num);arr=(int*)malloc(num*sizeof(int));for(i=0;i<num;i++){scanf("%d",arr+i);}/* Write the logic to reverse the array. */for(i=0;i<(num/2);i++){arr[i]=arr[i]+arr[num-(i+1)];arr[num-(i+1)]=arr[i]-arr[num-(i+1)];arr[i]=arr[i]-arr[num-(i+1)];}for(i=0;i<num;i++)printf("%d ",arr[i]);
Cookie support is required to access HackerRank
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 →