-
What will be the output of the following C code?
#include <stdio.h>
int *fun();
void main()
{
int n = A();
printf("%d", n);
}
int *fun()
{
int num[5] = {51, 18, 25};
return num;
}
-
- 51 18 25
- 25 18 51
- 18 25 51
- Compilation Error
- None of these
Correct Option: A
Compilation Error
main.c: In function ‘main’:
main.c:5:17: warning: implicit declaration of function ‘A’ [-Wimplicit-function-declaration]
int n = A();
^
main.c: In function ‘fun’:
main.c:11:16: warning: function returns address of local variable [-Wreturn-local-addr]
return num;
^~~
/tmp/ccNdhoL1.o: In function `main':
main.c:(.text+0xe): undefined reference to `A'
collect2: error: ld returned 1 exit status