> is it true that A. calloc allocates memory in contiguous bytes, malloc does not ensure contiguous memory allocation?
No, it's false.
calloc is nothing more than malloc + memset to wipe the memory to all-bits-zero.
> i mean early intell CPUs could onley address (64K)
Only 64K in a single block.
If you wanted more, then you had to start messing about with segment registers
http://en.wikipedia.org/wiki/X86
> how can i use malloc or calloc for a two demontional arrays?
One (of several) ways
char **arr = malloc( rows * sizeof *arr );
for ( r = 0 ; r < rows ; r++ ) {
arr[r] = malloc( cols * sizeof *arr[r] );
}
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953