im just wondering if im using a 'char**' (and dynamic memory) properly, if you could let me know. ie, missing another set of []'s or a * or & somewhere.i know this program isnt useful, im just wondering if it is correct.Code:#include<stdio.h> #include<string.h> int main() { char* test= "hello there"; char** temp = (char**) malloc(sizeof(char**) * 1); temp[0] = (char*) malloc(sizeof(char*)* 20); strcpy(temp[0],test); printf("'%s'\n",temp[0]); free(temp[0]); free(temp); getchar(); }
thanks