I\'m trying to return the data pointer from the function parameter:
bool dosomething(char *data){ int datasize = 100; data = (char *)malloc(datasize);
You're passing by value. dosomething modifies its local copy of data - the caller will never see that.
dosomething
data
Use this:
bool dosomething(char **data){ int datasize = 100; *data = (char *)malloc(datasize); return 1; } char *data = NULL; if(dosomething(&data)){ }