Declaring a structure pointer as a return type for a function

Your main problem is you are declaring node and ptr inside main. Your function definition for enter and the rest of your functions will not see the declarations inside main(). You need to move

struct node {
    int info;
    node* next;
} * ptr, *y, *save, *start;

to before int main() to fix this issue.

Leave a Comment