#include #include struct stack { int data; struct stack *next; }; struct stack *top = NULL; int size = 0; struct stack *createNode(int data) { struct stack *newNode = (struct stack *) malloc(sizeof(struct stack)); newNode->data = data; newNode->next = NULL; return newNode; } void push(int data) { struct stack *newNode = createNode(data); newNode->next = top; top = newNode; size++; } int getSize() { return size; } int getTop() { if (top == NULL) { printf("Stack is empty.\n"); return -1; } return top->data; } int main() { int a,b,c; scanf("%d",&a); push(a); scanf("%d",&b); push(b); scanf("%d",&c); push(c); printf("Size: %d\n", getSize()); printf("Top: %d\n", getTop()); }