![]() |
length of 2D Array >> char **myString= (char **) malloc (sizeof (char *));
Hi,
does someone know how to get the length of a 2 dimensional string array: here what i need: ---------------------------------------------------------------- char **getList(void){ char **myString= (char **) malloc (sizeof (char *)); for(int i=0;i<10;i++){ myString= (char **) realloc (myString, (i+1) * sizeof (char *)); myString[i] = (char *) malloc (255 * sizeof(char)); strcpy (myString[i],"List Item"); } return myString; } void something(void){ char **dataList = getList(); int length = ????? // IDEA ? for(int i=0;i<length;i++){ printf(dataList[i]); } } ---------------------------------------------------------------- if done several experiments with sizeof like int length = (sizeof(array)/sizeof(array[0]) but most time i always get length = 1. sorry, thats a bit simple, but i am cosseted java progger ;) you know > "my String".length. So, if you know, please tell me. best Regards, David |
| All times are GMT. The time now is 01:01 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.