/* Copyright( c ), 2010, @ linux laboratory in xiyou. All rights reserved. File name: front_list.c. Programmer's name: Harry . wei. Start time: 5, 31. Finish time: 5,31. Programme's introduction: use front list to init the list. Modify time: Modify programmer: Modify introduction: */ #include <stdio.h> #include <stdlib.h> #include <stdbool.h> typedef struct Mystruct_Node { int data; struct Mystruct_Node * next; }*Linklist, List; int main( void ) { printf( "111111" ); Linklist l; Linklist s; char c; // int flag = 1; l -> next = NULL; printf( "Please enter characters:" ); printf( "11111\n" ); while( true ) { c = getchar(); if( c != '$' ) { s = ( Linklist )malloc( sizeof( List ) ); s -> data = c; s -> next = l -> next; // First, s->next get the NULL value from l->next. l -> next = s; } else { break; } } l = l -> next; while( l -> next != NULL ) { printf( "%c", l -> data ); l = l -> next; } return( false ); }
Linklist l; //Uninitilazed pointer to List structure Linklist l = (Linklist)malloc(sizeof(List));//Initialized pointer to List structure (heap) List l; //Initialized List structure (stack)
harryxiyou wrote:l -> next = NULL;
l
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)