Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- typedef struct szam{
- int data;
- struct szam * next;
- }node;
- void addlist(int data, node*head){
- node* temp=head;
- while(temp->next!=NULL){
- temp=temp->next;
- }
- temp->next=(node*) malloc(sizeof(node));
- temp=temp->next;
- temp->next=NULL;
- temp->data=data;
- }
- void printnode(node *root){
- node*temp=root;
- while(temp){
- printf("%d,",temp->data);
- temp=temp->next;
- }
- }
- void main(){
- node * head=NULL;
- addlist(10,head);
- addlist(20,head);
- printnode(head);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement