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

Popular posts from this blog

1111. appearing after print sequence - php -

node.js - Express and Redis - If session exists for this user, don't allow access -

excel - I can't get the attachement of the email PHP -