c - Confusion about array declaration -


what mean in c:

char strings[ushrt_max][50]; 

is creating jagged array of characters called strings?

no, above not create jagged array of strings. creates array of characters 2 dimensions, capable of storing ushrt_max c strings of 49 characters in length (the fiftieth char used '\0' terminator).

a jagged array declaration this:

char *strings[ushrt_max]; 

with array of pointers need allocate memory individual strings, strings differ in length 1 element other. array, on other hand, has memory allocated, places limit on length of strings, , has potential of using more memory need store shorter strings.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -