You are on page 1of 3

2/13/2015

Home

C Program to Create Singly Linked List .using Node Structure - Data Structure - c4learn.com

C Programs

Java

Linked List

MCQ

Tut orials

Examples

Civil Services

Apt it ude

Advert ise

C Program to Create Singly Linked List .using Node Structure

Linked List Home

Programming Tutorials

Introduction to linked list

Like 31,649

Linked list advantages


Linked list disadvantages
Linked list Vs array
Singly linked list
Doubly linked list
Circular linked list
Singly linked list node structure
LL Operations

Create singly linked list

Program to Create Singly Linked List .


More Detailed Step By Step Explanation

Traversing through LL
Display Linked List from First
to Last
Linked list terms
Insert node at First Position
Insert node at Last Position
Insert node at middle position
Delete Node from First Postion
Search Perticular Element
Counting number of Nodes in
Singly Linked List
C Program to Create Singly
Linked List .using Node
Structure

//Program by :- Pritesh A Taral


#include<stdio.h>
#include<conio.h>
#include<alloc.h>
//------------------------------------------------struct node
{
int data;
struct node *next;
}*start=NULL;
//-----------------------------------------------------------void creat()
{
char ch;
do
{
struct node *new_node,*current;
new_node=(struct node *)malloc(sizeof(struct node));
printf("nEnter the data : ");
scanf("%d",&new_node->data);
new_node->next=NULL;
if(start==NULL)
{
start=new_node;
current=new_node;
}
else
{
current->next=new_node;
current=new_node;
}

Programming

Web Hosting

200+ C Programs

Learn Ajax

Learn C

Learn Android

Learn C++

Learn AngularJS

Learn Linked List

Learn AWK

Learn Stack

Learn Bootstrap
Learn CSS

Java
Technologies

Learn Ant
Learn Collection
Learn Eclipse
Learn Java
Learn JDBC
Learn JSP
Learn JSTL
Learn Servlet
Learn Swing

Learn ExtJS
Learn HTML
Learn JavaScript
Learn jQuery
Learn JSON
Learn PHP
Learn SQL
Learn VBScript
Learn XML
Learn XML DTD

Metro Social Media

printf("nDo you want to creat another : ");


ch=getche();
}while(ch!='n');
}
//-----------------------------------------------------------------void display()
{
struct node *new_node;
printf("The Linked List : n");
new_node=start;
while(new_node!=NULL)
{
printf("%d--->",new_node->data);
new_node=new_node->next;
}
printf("NULL");
}
//---------------------------------------------------void main()
{
create();

http://www.c4learn.com/data-structure/c-program-to-create-singly-linked-list/

1. Linux Training

2. Build a Web Site

3. Online Training Courses

1/3

2/13/2015

C Program to Create Singly Linked List .using Node Structure - Data Structure - c4learn.com
display();
}
//----------------------------------------------------

4. Mobile App Development

Output :
Enter the data : 10
Do you want to creat another : y
Enter the data : 20
Do you want to creat another : y
Enter the data : 30
Do you want to creat another : n
The Linked List :
10--->20--->30--->NULL

5. C Programming

6. Java Programming

7. C Compilers

More Detailed Step By Step Explanation

BPL: Football
Highlights

8. C for Embedded Systems

Enter your email address:

Watch Highlights of all


Premier League Matches Here.
Subscribe

Previous Page
Recent Posts

Python dictionary clear() : method


Load Comments

Python Comparison Operators


Python Assignment Operators
Python Arithmetic Operators
No cases in switch case : C
Programming
Eclipse Creating Java Class
Eclipse Creating Java Package
Eclipse Creating Java Project
Eclipse IDE Workspace

Eclipse IDE Views


Eclipse IDE Menubar
Eclipse IDE Windows : Views

Linux T raining
Build A Web Site
Mobile App Development
C Programming
C Online T raining
Java Programming

http://www.c4learn.com/data-structure/c-program-to-create-singly-linked-list/

2/3

2/13/2015

C Program to Create Singly Linked List .using Node Structure - Data Structure - c4learn.com

About the Author

Pritesh Taral is a Programmer, Web Developer and


founder of c4learn.com, a widely-read
programming site for beginners. Email: pritesh [at]
c4learn.com
2009-2014 Programming Tutorials.
The content is copyrighted to Pritesh Taral and may not be
reproduced on other websites.

http://www.c4learn.com/data-structure/c-program-to-create-singly-linked-list/

3/3

You might also like