We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Sorry i haven't read the notes before. So i am sending it again.When I debugging my program, the following function is not working proper. Actually this function runs properly on C, but not in Keil. There are 2 different problems occured. 1) strcat cannot add 2 strings. after strcat no any results. 2) once i merge this function into main function, the second memmmove is also working inproper. The pointer of T and CngStr are becoming the same. How can I solve it?
void main() { SerialInit(); printf("After Function %s\n",Change("0912cf4f3c")); return; } char *Change(char *Str){ char *CngStr; char *T; char *Change(char *Str){ char *CngStr; char *T; CngStr = (char *) malloc (strlen(Str)+2); T = (char *) malloc (strlen(Str)); strcpy(CngStr,""); strcpy(T,""); memmove(CngStr,Str+2,8); CngStr[8] ='\0'; memmove(T,Str,2); T[2] ='\0'; strcat(CngStr,T); free(T); return(CngStr); }