Home » C Programming » Typedef » Question
  1. Which of the following will be the correct output for the program given below ?
    #include<stdio.h>
    int main ( )
    {
    typedef int arr[ 5 ];
    arr new_arr = {1, 2, 3, 4, 5 };
    int k ;
    for (k = 0; k < 4 ; k++)
    printf("%d", new_arr[k] );
    printf("\n");
    return 0;
    }
    1. 1 2 3 4
    2. 1 2 3 4 5
    3. No output
    4. Error: Cannot use typedef with an array
Correct Option: A

There is no error in the code. So output will be 1 2 3 4



Your comments will be displayed only after manual approval.