Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- struct num{
- int content;
- struct num *next;
- };
- typedef struct num numbers;
- void Insert(int new_content,numbers *id_num){
- numbers *mold;
- mold = malloc (sizeof (numbers));
- mold->content = new_content;
- mold->next = id_num->next;
- id_num->next = mold;
- }
- void PrintContent(numbers *id_num){
- if(id_num!=NULL){
- printf("%d\n",id_num->content);
- PrintContent(id_num->next);
- }
- }
- int main(){
- numbers head;
- numbers *list_numbers;
- list_numbers = &head;
- head.next = NULL;
- Insert(10,list_numbers);
- Insert(5,list_numbers);
- Insert(3,list_numbers);
- Insert(8,list_numbers);
- Insert(1,list_numbers);
- PrintContent(list_numbers->next);
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement