Code:
struct node
{
int data;
struct node *next;
};
typedef struct node node;
typedef struct node* pnode;
void main()
{
pnode head;
node n0,n1,n2,n3;
n0.data=50;
n1.data=100;
n2.data=150;
n3.data=200;
n0.next=&n1;
n1.next=&n2;
n2.next=&n3;
n3.next=NULL;
head=&n0;
while(head!=NULL)
{
printf("%d\t",head->data);
head=head->next;
}
}
struct node
{
int data;
struct node *next;
};
typedef struct node node;
typedef struct node* pnode;
void main()
{
pnode head;
node n0,n1,n2,n3;
n0.data=50;
n1.data=100;
n2.data=150;
n3.data=200;
n0.next=&n1;
n1.next=&n2;
n2.next=&n3;
n3.next=NULL;
head=&n0;
while(head!=NULL)
{
printf("%d\t",head->data);
head=head->next;
}
}
evo sto sam ja nacinio
Code:
struct node
{
int data;
struct node *next;
};
typedef struct node node;
typedef struct node* pnode;
void main()
{
pnode head;
pnode p;
for(int i=0;i<4;i++)
{
head=(pnode)malloc(sizeof(node));
printf("Upisi broj> ");
scanf("%d",&head->data);
head=head->next;
}
head=NULL;
p=&head[0]; // jeli ovo isto kao p=head;
while(p!=NULL)
{
printf("%d\t",p->data);
p=p->next;
}
}
struct node
{
int data;
struct node *next;
};
typedef struct node node;
typedef struct node* pnode;
void main()
{
pnode head;
pnode p;
for(int i=0;i<4;i++)
{
head=(pnode)malloc(sizeof(node));
printf("Upisi broj> ");
scanf("%d",&head->data);
head=head->next;
}
head=NULL;
p=&head[0]; // jeli ovo isto kao p=head;
while(p!=NULL)
{
printf("%d\t",p->data);
p=p->next;
}
}
Molio bih pomoc uz objasnjenje ako ne predstavljaa problem,hvala.