![]() |
| ||
| What's the difference?(linked list) hi there.....i wonder what's the difference with these 2 linked list... 1. 2. and this.... temp->name=(char*)malloc(strlen(tempString)+1); i hope someone will answer me.........pls explain in simple english so that i can understand well...im not an American...=) thank a lot..peace!! |
| ||
| Re: What's the difference?(linked list) >>//why this doesnt have sizeof? =)temp->name=(char*)malloc(strlen(tempString)+1); >>//this is based on the linked list example 1(above) >>//why this doesnt have sizeof? =) It doesn't use sizeof(tempString) probably sizeof(any pointer here) is only 4 on 32-bit machines while the length of the string can be much much more than that. And the size of a character array may or may not be the same as the length of the string in the array. char str[255] = "Hello";in the above, sizeof(str) is 255, but strlen(str) is only 5. |
| All times are GMT -4. The time now is 9:29 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC