typedef struct stack
{
struct stack *ptr;
char* data;
}*tStack;
typedef struct{
tStack top;
}*tStack_ptr;
void Sinit(tStack_ptr s)
{
s->top = NULL;
}
int main() {
//stack
tStack_ptr s;
Sinit(s);
return 1;
}
When trying to assign top to NULL it gives me segmentation fault, any ideas? Does it have something to do with anonymous struct?