c - Can you find the length of a string from an array of pointers to strings? -
can find length of string doing subtraction on array of pointers strings? example if have code below
char *pstrings[4] = { "first string", "hello", "afternoon", "ab" }; int firststrlen = pstrings[1] - pstrings[0] - 1; //will length of first string doing this? will firststrlen length of first string?
no. there no guarantee strings located next each other in memory.
Comments
Post a Comment