Computer Science, asked by samarthgupta2022, 1 month ago

What is the output of C program with arrays.? int main() { int ary(3)=[20,30,40); printf("%d", a(t); } Option 1: 30 Option 2: Error Option 3: Option 4 20​

Answers

Answered by anindyaadhikari13
2

\texttt{\textsf{\large{\underline{Given C{o}de}:}}}

#include <stdio.h>

int main() {

   int ary(3)=[20,30,40);

   printf("%d",a(t));

   return 0;

}

\texttt{\textsf{\large{\underline{O{u}tput}:}}}

Error.

\texttt{\textsf{\large{\underline{Explanation}:}}}

  • The given co‎de has two errors. First of all, array elements are written inside curly brackets. The size of the array must be written between [ and ] instead of ( ). Also there is no variable named 't' is declared. So, error occurs when you will try to execute the co‎de.

Corrected Co‎de:

#include <stdio.h>

int main() {

   int ary[3]={20,30,40};

   printf("%d",ary[1]);

   return 0;

}

Output:

>> 30

Answered by athukatore
0

Answer:

Explanation:

What is the output of C program with arrays and pointers.? int main() { int a[3]-(20,30,40 ...

Similar questions