Well as an example of how to make the code look complicated, it achieves it's aim.
It's also broken as well.
Code:
labeltemp2:
free(temp2); /***Look clear and resource quickly release*****/
printf("%s",temp1);
If your previous 'goto labeltemp2' actually happened due to malloc failing (as suggested by the comment), then temp1 would still contain garbage data which would be printed.
If you want something clearer, perhaps
Code:
#include<stdio.h>
#include<stdlib.h> /* malloc lives here */
#include<string.h>
int main(int argc, char *argv[])
{
char * temp1;
char * temp2;
temp1 = malloc(7); /* casts are not necessary if you're compiling with a C compiler */
temp2 = malloc(7);
if ( temp1 != NULL && temp2 != NULL ) {
/* all resources acquired, do the work */
strcpy(temp1,"hello ");
strcpy(temp2,"world.");
printf("%s%s\n", temp1, temp2);
}
free(temp1); /* free(NULL) is a safe thing to do */
free(temp2); /* in case only one of the malloc's failed */
return 0;
}