Programming Language Array in C Language Question #1431
Single Choice Not Set

QWhich of the following statements are correct about the program below?

#include<stdio.h>
void main()
{
    int size, i;
    scanf("%d", &size);
    int arr[size];
    for(i=1; i<=size; i++)
    {
        scanf("%d", arr[i]);
        printf("%d", arr[i]);
    }
}

ID: #1431 Array in C Language 821 views
Question Info
#1431Q ID
Not SetDifficulty
Array in C LanguageTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A The code is erroneous since the statement declaring array is invalid.
  • B The code is erroneous since the subscript for array used in for loop is in the range 1 to size.
  • C The code is correct and runs successfully.
  • D The code is erroneous since the values of array are getting scanned through the loop.
Correct Answer

Explanation

The code is erroneous since the statement declaring array is invalid.

Share This Question

Challenge a friend or share with your study group.