My stack_d.h file
#ifndef stack_d #define stack_d struct s { int boyut; int tepe; int dizi; }; typedef struct s* stack; stack * init (); int pop(stack *); void push (int, stack *); void bastir(stack *); #endif
My stack.c file
#include <stdio.h> #include <stdlib.h> #include "stack_d.h" stack * init(){ stack *s = (stack *) malloc(sizeof(stack)); s->dizi =NULL; s->boyut =2; s->tepe=0; return s; } int pop(stack *s ){ if (s->tepe <= s->boyut/4){
I tried this s pointer with -> but my compiler says did you mean to use ->? What should I do?
What should I do?
Remove the pointer from the typedef:
typedef
typedef struct s stack;
and your code should be fine. Do not use pointer typedefs, they are very confusing.
2.1m questions
2.1m answers
60 comments
57.0k users