2008年11月5日 星期三

Some hints in the C programming

1. Before using the character strings (either char array or malloc buffer), it is better to clean up all the buffer to zero (using memset(buf, 0, bufsize) or bzero function)

Question:
Sometimes we use the following declaration

char *mystr;

Then we can assign a string to the variable "mystr", like this. Is it valid to use this method?
mystr = "hello world";

沒有留言: