segmentation fault
Posted
by gcc
on Stack Overflow
See other posts from Stack Overflow
or by gcc
Published on 2010-05-16T20:00:24Z
Indexed on
2010/05/16
20:10 UTC
Read the original article
Hit count: 236
Filed under:
c
int num_arrays;
char *p[20];
char tempc;
int i=0;
do
{ p[i]=malloc(sizeof(int));
scanf("%s",p[i]);
tempc=p[i];
++i;
}while(tempc=='x');
num_arrays=atoi(p[0]);
When i write num_arrays=atoi(..)
,gcc give me segmentation fault or memory
stack is exceeded, I don't understand why it behaves like that
can anyone explain, why?
© Stack Overflow or respective owner