#include<stdio.h>
#define length 9
//https://www.studytonight.com/c/datatype-in-c.php/
//http://www.cplusplus.com/reference/cstdio/printf/
int main()
{
short unsigned int num[length];
for(int x=0; x<length;x++) //Fill the array with numbers 0-length
num[x]=x;
for(int x=0; x<length;x++) //Print initial array
printf("%hu\n", num[x]);
printf("\nReversing...\n\n");
for(int x=0, y; x<length/2;x++)
{
y=num[x];
num[x]=num[length-x-1];
num[length-x-1]=y;
}
for(int x=0; x<length;x++) //print reversed array
printf("%hu\n", num[x]);
return 0;
}
Comments