Consider the following ‘C’ Program:
# include <stdio.h>
int main ()
{
int max, i;
scanf (“%d”, & max);
int a[max];
for (i=1; i<max; i++)
{
scanf (“%d”, a[i]);
printf(“%d \n”, a[i]);
}
return 0;
}
Which of the following statements are correct about the ‘C’ program given above ?
(a) The code is correct and runs successfully
(b) The code is erroneous since the statement declaring array is invalid
(c) The code is erroneous since the subscript for array used in ‘for’ loop is in the range 1 to max - 1
(d) The code is erroneous since the type declaration statement int a [max]; is done after scanf()
1. (a) and (c)
2. (b) and (c)
3. (b) and (d)
4. (c) and (d)