Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- typedef struct node
- {
- int a;
- char ch;
- struct node *next;
- }node;
- node *head;
- void insert_at_first(int aN, char chN)
- {
- node *N=(node*)malloc(sizeof(node));
- N->a=aN;
- N->ch=chN;
- N->next=NULL;
- if(head==NULL)
- {
- head=N;
- return;
- }
- N->next=head;
- head=N;
- }
- int main()
- {
- head=NULL;
- insert_at_first(5,'x');
- insert_at_first(4, 'y');
- insert_at_first(3, 'z');
- insert_at_first(9, 'i');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement