|
questions in memset
HI all ,
please find the piece of code below
char *t[100];
char *f[100];
char buf[60];
memset(buf,0,50);
after that i am assigning memory
for (i=0; i<100; i++)
{
t[i] = buf+(i*6);
f[i] = "ARUN";
}
my question ..
1) i have run this it is working in one system and not working other system
my doubt is t[i] we are allcation is having 600 bytes memory bu the loop increaments and it calculates as buf+i*6
will this result to segmentation fault(core dump) .. Why it is runningin one system and same exe is making core dump in other
the core dump occurs when i tried to loop through t array
2) I have set 50 byte to 0 by memset when i print by the buf by gdb i am getting only 10 bytes assigned to null not all why ??.. please let me know..
3) Even though i am having only 60 sapces in buf array how the t array points to 600 location ?.. Is it possible..
Thanks,
Arun
|