Operation on list - c++ program, C/C++ Programming

Operation on list - c++ program:

Write a program in c to Insert value on list and list iteration.

typedef struct item *node_ptr;

struct item {

                  int element;

                  node_ptr next;

                  }

typedef node_ptr list;

typedef node_ptr position;

 

void main()

{

list head;

 

void  create(list);

void print(list);

head=(list)malloc(sizeof(struct item));

head->next=NULL;

 

create(head);

print(head);

}

 

void create(list head)

{

 position temp;

 char opt;

 

 while (1)

 {

 printf("Enter yuor option\n");

 flushall();

 scanf("%c",&opt);

 

 if(opt=='n'||opt=='N')

 

 return;

 if(head->next== NULL)

 

 head->next=temp=(position)malloc(sizeof(struct item));

 else

 temp=temp->next=(position)malloc(sizeof(struct item));

 temp->next =NULL;

scanf("%d",&temp->element);

}

}

void  print(list head)

 { position temp;

  temp =head->next;

  while (temp  !=NULL)

  {

  printf("%d",temp->element);

  temp=temp->next;

 

 }

 }

Posted Date: 10/19/2012 2:57:45 AM | Location : United States







Related Discussions:- Operation on list - c++ program, Assignment Help, Ask Question on Operation on list - c++ program, Get Answer, Expert's Help, Operation on list - c++ program Discussions

Write discussion on Operation on list - c++ program
Your posts are moderated
Related Questions
A: This will turn o_ "name mangling" for func so that one can connect to code compiled by a C compiler.

There are formal ways of reducing Boolean expressions in order to minimize the logic circuit. The two elementary ways of minimization are using Boolean expressions/De Morgan Theore


hi Bhasker, as we spoke tru phone ,we need a project using cloud computing .we need to present a protoype or demo on it (any thing using cloud should be fine)(ex: P2p)

External Variables Different functions of the similar program can be written in different source files and can be compiled together. The scope of a global variable is not limit

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

how to decode the numerals to string..

how can i print any english work using star .?

A: Depends. Might be "zero" Objects which are thrown must have a publicly accessible copy-constructor. The compiler is permitted to generate code which copies the thrown object

Introduction:  This assignment requires a knowledge of variables (integers, char types), loops, conditionals, switch, functions, char arrays, string arrays, number arrays, struc