C language is a middle level language. It is a structured language. C language is a case sensitive language. All syntax written in c language is in lower case. C is the basis for C++.


What is C C vs C++ vs Java Program Structure Data Types in C Basic Rules of C & C++
Functions in C If, Else Conditions Loops in C Switch Case Arrays
Pointers Structures in C Strings in C Command Line Arguments Type Casting
Linked Lists Recursion Binary Trees Inheritance Multiple Inheritance
Templates File I/O Object Oriented Programming Data Structures in C C interview Questions

Linked Lists : C Language Tutorial


Linked Lists are Simple data structures which are used to implement abstract data structures, like stack, queues, hash tables etc. The concept of linked lists is easy.

Each record of a linked list is called an element or node. Each node has min. two members, one of which points to the next item or node in the list.

These are called as Single Linked Lists because they only point to the next one, and not the previous.

Those lists that do point to both are called Doubly Linked Lists or Circular Linked Lists.

example of linked list using typedef

typedef struct node
int numdata;
struct node * nextnode;
} node;

node * linkedlist;

Each node has two fields. The first field is the data field, this could be any data type.
The second field is a pointer to another node structure. This will be used as the next pointer.

example of linked list without typedef

struct linkedlist
float marks;
struct linked_list *next;
struct Linked_list node1,node2;

Simple Linked List C Program:

You can make a header file with a different name and cut paste from #define ----till *next; and save that file with say yourname.h header file so that you can include it afterwards above like #include<yourname.h> for ease of program or use the structure within the program as used below.

Linked List vs Array

In arrays we can access an element by index but we cant increase the size.
Whereas Linked Lists can be increased or decreased + No memory is wasted.
We will have to traverse the entire list to go to the last element of the list, that's a disadvantage of linked list.

Free C Programs

Simple Linked List

A linked list is one of the fundamental data structures, and can be used to implement other data structures

Doubly Linked List

Doubly Linked List Implementation

Push and Pop in Linked list

Learn how to Push & Pop in a Linked List