Solved programming problem

How to Create a linked List and Save Value in C.

Source code

#include<stdio.h>

struct list ///create a  structure for linked list

{

    int value;

    struct node *next;

};

typedef struct list Node; ///create a Node Type structure Variable

int main()

{

    Node *a;  ///node type variable

    a = (Node *)malloc(sizeof(Node)); ///create space for new node

    a->value = 10; ///save value

    a->next = NULL; /// save address as null

   printf("Data: %d
", a->value);

   printf("Address: %d
",a->next);

    return 0;

}

Output

Data: 10
Address: 0

Join the discussion

Add your comment