Code:
#include <stdio.h>
#include <stdlib.h>

typedef struct node {
  int a;
  int b;
  struct node *next;
} *list;

void print(list head);

int main()
{
  list ptr, new ;
  int n;
  
  ptr=NULL;
  new = malloc(sizeof(struct node));
  new->a = 1;
  new->b = 2;
  new->next = NULL;
  printf ("Enter both integers separated by a space.\nIf you want to stop, write everything but integers.\n");

do {
n = scanf("%d %d", &new->a, &new->b);
if (n != 2) {
printf("You must write integers only\n");
return 1;
}
}
while (n==2);

printf("Integers you entered: %d %d", new->a, new->b);
return 0;


   print(ptr);
}



void print(list head) { 
    list curr; 
    int i=0; 
    curr=head;
 
    printf("Printing the list:\n"); 
    while(curr) { 
        printf("%d\n", curr->a);
	 printf("%d\n", curr->b);
        curr=curr->next; 
        i++; 
    } 
    printf("Printed %d elements\n", i); 
}
Could you tell my why void function is not working here?