#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
struct node
{
int info;
struct node *next;
};
struct node *start=NULL;
void create_list(int data)
{
struct node *q,*temp;
temp=(struct node *)malloc(sizeof(struct node));
temp->info=data;
temp->next=NULL;
if(start==NULL) //if list is empty //for the first time only!
{
start=temp; //start will store the address of the first element of the list.//it will be same till the end of list.//last element points to NULL so start also points to NULL at last!//so we can say that start is a pointer variable which always stores address of first element in it!//so when ever we want to access any element in linked list we have to use start variable to access it!//in array we can directly access any element using its index but in linked list we have to use its address and for that purpose start variable is used!///now if you want to know why this statement "temp->next=NULL" has been used then please read my notes carefully because i have explained it there in detail!!///now lets move forward..!!/////now lets move forward..!!/////now lets move forward..!!/////now lets move forward..!!/////now lets move forward..!!/////now lets move forward..!!/// now if you want to know why this statement "temp->next=NULL" has been used then please read my notes carefully because i have explained it there in detail!!///now lets move forward..!!/////now lets move forward..!!/////no
免责声明:
以上内容除特别注明外均来源于网友提问,创作工场回答,未经许可,严谨转载。