[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Nbd] [NBD]A problem about nbd-client



nbd-client.c

...
int opennet(char *name, int port, int sdp) {
	int sock;
	char portstr[6];
	struct addrinfo hints;
	struct addrinfo *ai = NULL;
	struct addrinfo *rp = NULL;
	int e;

	snprintf(portstr, sizeof(portstr), "%d", port);

	memset(&hints,'\0',sizeof(hints));
...
}
....

I don't know why we use 'memset(&hints,'\0',sizeof(hints));', what
about 'memset(&hints,0,sizeof(hints));' instead? I usually use
'memset(&hints,0,sizeof(hints));' to initialize these memory. Cloud
anyone tell me the difference beween these two methods? Actually
i think '\0' is a terminal character of an array, right?

-- 
Thanks
Harry Wei



Reply to: