I understand malloc allocates memory and doesn't reset the contents, butCode:{ char (*a)[100]; a = malloc (2 * 100); a[1] = "Hi "; a[2] = "Hello"; /*need to put more records to a, so go for resize...!*/ a = malloc (4 * 100); }
here the question is
1. Can malloc be used for extending size without loosing the existing contents
(as realloc)....?
2. Does elements "a[0], a[1]" still be in the same address and "a[3], a[4]" to
the new address...!
or
Entire "a" ("a[1 to 4]") will be moved to some other new contiguous
memory...?
Thanks for any suggestions.....!