buf is a automatic variable for tm2str, when func is finished it is deallocated.
instead of char *buf; put char *buf = malloc(20 * sizeof(char)); and in main after printf put free(out);.
Type: Posts; User: littletics
buf is a automatic variable for tm2str, when func is finished it is deallocated.
instead of char *buf; put char *buf = malloc(20 * sizeof(char)); and in main after printf put free(out);.
thank you guys, i have understood the type difference &a and a.
i am sorry i have a mistake in the 2 question in declaration
it should be (*p)[m]. after all, now i can answer my 2 question myself...
i have read many about pointers and understood very good. but still there are some confusing thinks. please help to understand.
1) int a[];
why *&a doesn't give the first value of array? instead...