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 -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -