1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
almond37 [142]
2 years ago
13

Write a program to demonstrate circular linked list with operations using pointers – insert

Computers and Technology
1 answer:
BabaBlast [244]2 years ago
5 0

A program to demonstrate circular linked list with operations using pointers is:

struct Node *addToEmpty(struct Node *last, int data)

{

   // This function is only for empty list

   if (last != NULL)

     return last;

 

   // Creating a node dynamically.

   struct Node *temp =

         (struct Node*)malloc(sizeof(struct Node));

 

   // Assigning the data.

   temp -> data = data;

   last = temp;

   // Note : list was empty. We link single node

   // to itself.

   temp -> next = last;

 

   return last;

}

<h3>What is a Circular Linked List?</h3>

This refers to the type of linked list in which the first and the last nodes are also joined together other to form a circle

Read more about circular linked list here:

brainly.com/question/12974434

#SPJ1

You might be interested in
_________function tells the cin object to skip one or more characters in the keyboard buffer.
Amanda [17]

Answer:

cin.ignore function written as  cin.ignore()

Explanation:

  • As we know that cin is an object that is used to obtain the input entered by the user through the keyboard.
  • cin.ignore() is a function which is used to ignore or skip one or more characters in the keyboard buffer.
  • Keyboard buffer is a small storage area which is used to store keystrokes.
  • When a key is pressed on the keyboard it is referred to as a keystroke.
  • So before processing, these keystrokes are stored in keyboard buffer.
  • So when we use cin to input a character from the user through the keyboard, the keyboard buffer must be empty. If that's not done then the character entered will be taken by the buffer of previous variable.
  • Lets take an example of why we want to use cin.ignore() function.
  • For example you want the employee (user) to enter his name and you are using cin to read this name from the user.

                                          char empname[8];

                                           cin>>empname;

  • Now if the user types his name lets say Anonymous and press enter key this will be taken as new line character and it will store this newline character \n into the buffer.
  • cin >> statement reads data from the buffer and stops reading when it reaches newline character.
  • So Anonymous is read in and stored in empname variable but newline character is left in the keyboard buffer.                          
  • Lets say after cin>>empname we write another statement that takes a character from user. A user wants to enter character "a".

                                char character;

                            character = cin.get();

  • When cin.get finds the newline  character \n in keyboard buffer, it uses it (as cin.get can read the newline character in the buffer) without waiting for the  user to input "a".
  • So cin.ignore() function is used to avoid such situation.
  • We can specify the characters to be ignore within the cin.ignore() function such as cin.ignore(10,'\n') will ignore 10 characters in the buffer before taking new line or until a \n character comes.
  • You can simply use cin.ignore() which will ignore the very next character just as \n in our example. In our example we can use cin.ignore() after the cin>>empname; and before using cin.get();
8 0
4 years ago
Which operating system is used by most desktop and laptop computers?
OleMash [197]
Right know, probably Windows 7. Linux is not really used for home use and there are not many people on mac. On Windows, the most popular is still Windows 7 because XP and Vista are dead and the servers, scrap them. Then windows 8 is not great and Windows 10 is not the best for work computers so most desktops and laptops are still running Windows 7.
6 0
4 years ago
The body element is where you provide browsers with information about the document
Yuliya22 [10]

The answer is False

The description above is the function of the head or the title element. The title element is used to identify the contents of an entire document. The title element may only appear once. On the other hand, the body element contains all of the content of an HTML document.


8 0
3 years ago
Additional rows and columns are inserted into a table using the
Paladinen [302]
The Option D , Table Tools Insert
6 0
2 years ago
Carbon monoxide poisoning can result from breathing
Mamont248 [21]
The answer is the letter a
6 0
3 years ago
Other questions:
  • An essential skill today is knowing how to cite sources properly. Creative Commons has a system of licenses and tools for creato
    11·1 answer
  • Define application pakage​
    5·2 answers
  • Which of the following SNSs has been associated with art work display?
    14·2 answers
  • How to find out what version of windows i have?
    13·1 answer
  • A ________ is a single media file including art, sound, animation, or movies.
    9·1 answer
  • What type of data uses numbers that can be used in the arithmetic operations?
    14·1 answer
  • Someone help meeeeeeeee plz.......................
    11·2 answers
  • Why does atmospheric pressure does not effect on planes,jet planes and rocket?​
    9·1 answer
  • Classify computer software and write short note about it ?​
    6·1 answer
  • Who knows my cousin better?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!