A
anonymous
Hi CLCers,
I am getting Segmentation fault, core dump error from the
following program. The program is a stack implementation
with push and pop functions(at present only push is
implemented). I dont know where i am erring. Here is the
program:
#include<stdio.h>
int main()
{
int * stackptr;
void push(int **pushint, int i);
/*Memeory allocation for stack*/
stackptr=(int *)malloc(100 * sizeof(int));
push(&stackptr, 10);
printf("The stack is %d\n",*stackptr);
return 0;
}
void push(int **stackptr, int i)
{
*stackptr=i;
}
Thanks in advance.
--Shan
I am getting Segmentation fault, core dump error from the
following program. The program is a stack implementation
with push and pop functions(at present only push is
implemented). I dont know where i am erring. Here is the
program:
#include<stdio.h>
int main()
{
int * stackptr;
void push(int **pushint, int i);
/*Memeory allocation for stack*/
stackptr=(int *)malloc(100 * sizeof(int));
push(&stackptr, 10);
printf("The stack is %d\n",*stackptr);
return 0;
}
void push(int **stackptr, int i)
{
*stackptr=i;
}
Thanks in advance.
--Shan