The problem is probably in the code you did not post. But I will mention that malloc will fail if the data segment has maxed out. I don't see you test for that. You'll get a null pointer with errno set to ENOMEM. Dereferencing a null pointer can cause a seg fault on some architectures.
thanks buddy your a gr8 help but will trouble you later for more queries .for now have this one.which is the command which asks the system to wait for some time(say millisec)before printing some statement
eg
something like this
waiting . . . . .
code is
int i;
for(i =0;i < 10;i++){
printf(" .");
//command i'm loooking which waits for(say 300 ms) (works in linux not windows)
}
printf("\n");