https://www.youtube.com/watch?v=ctyr__7wN_E
#include <stdio.h>
#include <stdlib.h>
struct node{
int data;
struct node* next;
};
void print(struct node* head){
head=head->next;
while(head!=NULL){
printf("%d ", head->data);
head=head->next;
}
}
int main(){
struct node* head;
struct node* two;
struct node* three;
head=(struct node*)malloc(sizeof(struct node));
two=(struct node*)malloc(sizeof(struct node));
three=(struct node*)malloc(sizeof(struct node));
head->next=two;
two->next=three;
three->next=NULL;
two->data=10;
three->data=20;
print(head);
return 0;
}
No comments:
Post a Comment