c define array size

#include <stdio.h>

#define SIZE 5

int main() {
    int arr[SIZE];
    printf("Size of array: %d\n", SIZE);
    return 0;
}

Explanation:

  • #include <stdio.h>: Includes the standard input-output header file for input and output operations.
  • #define SIZE 5: Defines a constant SIZE with a value of 5.
  • int main() { ... }: The main function where the program execution begins.
  • int arr[SIZE];: Declares an integer array arr of size SIZE, which is 5 in this case.
  • printf("Size of array: %d\n", SIZE);: Prints the size of the array using the %d format specifier in the printf function.
  • return 0;: Indicates successful termination of the main function and the program overall.