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

Assignment Help:

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;

 

 }

 }


Related Discussions:- Operation on list - c++ program

Standard template library , The STL details are described in many places on...

The STL details are described in many places online (see the CS377 webpage for some links), and there's a very quick introduction in Section A.14. Here are just a few additional no

What is the significance of external declaration, Problem 1 What is the...

Problem 1 What is the difference between function declaration and function definition? 2 Write a recursive function to find sum of even numbers from 2 to 10. 3 List some

C++, Write C++ code for calculating the time table

Write C++ code for calculating the time table

Write program.., # Dear I want help to programmer that write C++ code for...

# Dear I want help to programmer that write C++ code for my small project as soon as posible If we can help me?..

Stack, write a simple c++ program to implement a stack: 1. push 2. pop

write a simple c++ program to implement a stack: 1. push 2. pop

Define namespace in c++, It is a feature in C++ to reduce name collisions i...

It is a feature in C++ to reduce name collisions in the global name space. This namespace keyword assigns a separate name to a library that allows other libraries to use the simila

Calculation, write a program to calculate the cuboid

write a program to calculate the cuboid

I need whatsapp software in my website, I need whatsapp software in my webs...

I need whatsapp software in my website Project Description: i need whatsapp software in my website same this whatsapp if anyone can make to me this in my website Skills

Data Handling in computers, though the ascii is called 7-bit code. why do w...

though the ascii is called 7-bit code. why do we use 8-bits to represent a character?

C++ Assignment Help me , Write a c++ program that contain the following fun...

Write a c++ program that contain the following functions : 1) Function Quality_Point that takes one int argument (student_average) and return ‘A’ if the student_average between 90-

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd