#include <iostream> using namespace std; int* foo() { int arr[1] = { 42 }; return arr; } int main() { // your code goes here int x[1] = foo(); return 0; }
Standard input is empty
prog.cpp: In function ‘int* foo()’: prog.cpp:5:6: warning: address of local variable ‘arr’ returned [-Wreturn-local-addr] int arr[1] = { 42 }; ^~~ prog.cpp: In function ‘int main()’: prog.cpp:11:17: error: array must be initialized with a brace-enclosed initializer int x[1] = foo(); ^
Standard output is empty