int set_val(char **a) { *a=(char *)malloc(sizeof(char)*4); *(*a)='x'; *(*a+1)='y'; *(*a+2)='\0'; printf("%s\n",*a); return 0; } int main() { char * a=NULL; set_val(&a); printf("%s",a); return 0; }
Standard input is empty
prog.cpp: In function ‘int set_val(char**)’: prog.cpp:3: error: ‘malloc’ was not declared in this scope prog.cpp:7: error: ‘printf’ was not declared in this scope prog.cpp: In function ‘int main()’: prog.cpp:13: error: ‘NULL’ was not declared in this scope prog.cpp:15: error: ‘printf’ was not declared in this scope
Standard output is empty