Write a program to delete last node of a single link list

//deletion last node
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
struct node
{
int info;
struct node *link;
};
struct node *n,*first,*this1;
int main()
{
char ch;
int item;
clrscr();
first=NULL;
printf(“Enter q to quite: “);
while((ch=getche())!=’q’)
{
n=(struct node*)malloc(sizeof(struct node));
printf(“\nEnter info= “);
scanf(“%d”,&n->info);
n->link=NULL;
if(first==NULL)
first=n;
else
{
this1=first;
while(this1->link!=NULL)
this1=this1->link;
this1->link=n;
}
printf(“Enter q to quite: “);
}
this1=first;
printf(“\nTraversing of linklist:”);
while(this1!=NULL)
{
printf(“\n%d”,this1->info);
this1=this1->link;
}
this1=first;
while(this1->link->link!=NULL)
{
this1=this1->link->link;
free(this1->link);
this1->link=NULL;
}
this1=first;
printf(“\nTraversing After Delete last node:”);
while(this1!=NULL)
{
printf(“\n%d”,this1->info);
this1=this1->link;
}

getch();
return 0;
}