I don't understand why the print functions returns (null):
TestTest inside function
(null) after function call
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void get_string(char* name){
char* b ="TestTest";
name = (char *)malloc(sizeof(char)*strlen(b)+1);
strcpy(name,b);
printf("%s inside function\n",name);
}
int main(){
char *name;
get_string(name);
printf("%s after function call\n",name);
free(name);
}