I want to display the string copied in sh().
But its printing (null).Code:#include <stdio.h> #include <stdlib.h> #include <string.h> int sh(char * s) { s = malloc(20); strcpy(s,"Hello World"); return 0; } int main() { char *s=NULL; sh(s); printf("%s",s); /* Print Hello world*/ return 0; }
What's Wrong?