write an algorithm and a program to count the number of
elements in a circularly singly linked list
Answer / 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 |
Write a program to swap two numbers without using third variable?
What is omp_num_threads?
What does int main () mean?
# define prod(a,b)=a*b main() { int x=2; int y=3; printf("%d",prod(x+2,y-10)); } the output of the program is a.8 b.6 c.7 d.none
print 1-50 with two loop & two print Statement
IS STRUCTURES CAN BE USED WITHIN AN ARRAY?
wat is the difference between a definition and declaration? float y;---it looks like a declaration..but it s a definition.how?someone explain
what is the function of .h in #include<stdio.h> in c ?
23 Answers HCL, IBM, Wipro,
#define min((a),(b)) ((a)<(b))?(a):(b) main() { int i=0,a[20],*ptr; ptr=a; while(min(ptr++,&a[9])<&a[8]) i=i+1; printf("i=%d\n",i);}
how to swap 4 number without using temporary number?
how to write hello word without using semicolon at the end?
main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } what is the output?