DATA STRUCTURE practice

// data structure --- linked list 1 
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
using namespace std;
int main()
{
typedef struct list_node* list_pointer;        // create another name for list_node called list_pointer   
struct list_node 
     {  
    int data ;
    list_pointer link;
    } ;
//Variable 
list_pointer ptr = NULL;  // declare a variable called ptr and it is null
//Memory Allocation 
ptr=(list_pointer)malloc (sizeof(list_node));      // create a ptr (data type: list_pointer ) ( size: listNode )
ptr->data = 80;
ptr->link = NULL;
printf("%d",ptr->data);
free(ptr);
}

留言

這個網誌中的熱門文章

Codeforces --- string task

Uva 674 ---- coin change

codeforces 271A --- beautiful year