Example code for using #define for array size in c:
What is the output of below C program.
const int SIZE = 4;
for(int i=0; i
0, 1, 2, 3.
1, 2, 3, 4.
Compile time error at int arr[SIZE]; invalid declaration.
crash at run time.
const's are run time objects which programmer can't modify. Array size has to be done at compile time. so it is not possible to mix up const with array declarations. So Compile time error at int arr[SIZE]; invalid declaration.
Back To Top