Computer Science, asked by nijanthan46, 4 months ago

What is the output of C Program.? int main() { int a[]; a[4] = {1,2,3,4}; printf("%d", a[0]); } *
D) Compiler error
A) 1
C) 4
B) 2​

Answers

Answered by jassi1178
16

Answer:

1 is the answer

and mark me brainly

Answered by UsmanSant
0

What is the output of C Program.? int main() { int a[]; a[4] = {1,2,3,4}; printf("%d", a[0]); }

A) 1

C) 4

B) 2​

D) Compiler error

The output of the program is 1 (Option A)

  • This program has been done in C language.
  • The above program starts with making an integer type a and placing 1,2,3, and 4 making it an array.
  • Now array works by starting its index count from 0 in the case of the C program.
  • So at 0 positions, 1 is present. That means a[0] is equal to 1.
  • Similarly, a[1] is equal to 2, a[2] is equal to 3, and so on.
  • Thus the output of the above program after printing in the console is 1.

#SPJ2

Similar questions