Why i always get the address of the number??
2295367 >_<
#include<stdio.h>
#include<stdlib.h>
#define p printf
#define s scanf
#include<ctype.h>
struct node
{
int data;
struct node *link;
};typedef struct node *nodepointer;
void push(nodepointer &top,int number)
{
nodepointer newnode,temp;
newnode=(nodepointer)malloc(sizeof(struct node));
newnode->data=number;
newnode->link=NULL;
if(top==NULL)
{
top=newnode;
}
else
{
temp=top;
while(temp->link!=NULL)
temp=temp->link;
temp->link=newnode;
}do
{
p("\nEnter number: ");
fflush(stdin);
s("%i",&number);
}while(isalpha(number));
}
void display(nodepointer top)
{
if(top==NULL)
{
p("\nNothing to display");
}
else if(top!=NULL)
{
while(top->link!=NULL)
{
p("\n%i",top->data);
top=top->link;
}
p("\n%i",top->data);
}
}
main()
{
nodepointer top;
top=NULL;
int number;
int choice;
int found;
char operators;
do
{
p("\n[1].Push");
p("\n[2].Display");
p("\n[3].Add operator");
p("\nKey choice: ");
fflush(stdin);
s("%i",&choice);
switch(choice)
{
case 1:
push(top,number);
break;
case 2:
display(top);
}
}while(1==1);
system("pause");
}