write an algorithm and a program to count the number of
elements in a circularly singly linked list
Answer Posted / rakesh soni
struct node
{
int info;
struct node *next;
};
main()
{
struct node *head,*temp;
// here insert the elements in circular link list & suppose
//head have the starting pointer of circular link list
//head is not null
int count =1;
temp=head;
while(temp->next!= head)
{
count++;
temp=temp->next;
}
printf(" No of Elements = %d",count);
}
| Is This Answer Correct ? | 12 Yes | 14 No |
Post New Answer View All Answers
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?
What is an arrays?
List the different types of c tokens?
Who developed c language?
What is pointer and structure in c?
Where register variables are stored in c?
Describe newline escape sequence with a sample program?
What is keyword in c?
Is printf a keyword?
What is c++ used for today?
Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.
What is I ++ in c programming?
write a program to concatenation the string using switch case?
How was c created?
What is #include stdlib h?