On Sunday 29 September 2002 09:31 am, Amish Mehta wrote:
for( i =0 ; i
< 4; i++)
{
if((*(arg + i) = (char *)malloc(n * sizeof(char))) == NULL)
LHS should be *(arg + i * sizeof(char *))
As pointers(arg is pointer to pointer) are NOT 1 byte long.
Size depends on system. Generally 4 byte.
No, it does not need to be....
Pointers are internally ints (unsigned ??), no matter whatever be the
system....
So, it will automatically take whatever the system uses for address
manipulation.
For example, on DOS, int = 2 bytes(16 bits) = pointer.
That is why you need far & near pointers in DOS to access longer memory
addresses.
In case of Win32 ( GCC )/Linux, int = 4 bytes(32 bits) = pointer.
Hence, a single pointer can access all the addresses.
That is why, programs using 16 bit code on linux need to define new ints
having 16 bits - like GTK's gint16.
--
Kunal Gangakhedkar
---------------------------
MCA Student @ VJTI
kunal(a)vjtimca.net
kgangakhedkar(a)softhome.net
kgangakhedkar(a)hotpop.com
---------------------------
Do Miami a favor. When you leave, take someone with you.