c - difference between strlen(string) and strlen( *string) -


let's have array of strings of same size.

char strings[][max_length]; 

what difference between strlen(strings) , strlen(*strings)?

i know strings address of first string in array,

but *strings?

first, don't this. c allow lots of things bad idea. doesn't mean ought it. :)

while may have compiler warnings, these 2 identical. reason definition:

char strings[][max_length]; 

the allocation end being 1 continuous block. within block of memory, there no "structures" or management devices can used identify individual strings start , stop. creates interesting situation.

effectively, *string , string both pointers precisely same memory location. means calling strlen on either 1 of them return null delimited string length of first element in first array.

however, must reiterate... don't this.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -