This program serves as a practical example for beginners to understand array manipulation, function usage, and basic input/output operations in the C programming language. It also introduces concepts like function prototypes and error handling.

The main objective of the program is to read integers into an array, print the array, reverse its order, and print the reversed array.

Note: You can read more about Arrays in this article: Arrays in C

Main Functions of the Program

Key Features:

  1. intSwap Function:
  2. printIntArray Function:
  3. getIntArray Function:
  4. reverseIntArray Function:

Source Code of the C Program

Output of this C program is:

Enter integer [0 to terminate] : 5
Enter integer [0 to terminate] : 4
Enter integer [0 to terminate] : 3
Enter integer [0 to terminate] : 2
Enter integer [0 to terminate] : 1
Enter integer [0 to terminate] : 0
The array was:
5 4 3 2 1


After reversing, it is:
1 2 3 4 5