C coding check list
1 pointer set NULL
2 pointer memset must set specify Number, can not use sizeof
char *jason = NULL;
jason = malloc( 99999 );
memset(jason, '\0', 99999); //OK
2 pointer memset must set specify Number, can not use sizeof
char *jason = NULL;
jason = malloc( 99999 );
memset(jason, '\0', 99999); //OK
// memset(jason, '\0', sizeof(jason)); //NG
3 If malloc, must free after used.
4 file pointer must close before return.
FILE *fp
if(fp!=NULL)
fclose(fp);
return 0;
4 file pointer must close before return.
FILE *fp
if(fp!=NULL)
fclose(fp);
return 0;
留言
張貼留言