Write a program to reverse a linked list?
Answer Posted / bipin pandey
node *reverse(node *first)
{
node *cur,*temp;
cur=NULL;
while(first!=NULL)
{temp=first;
first=first->link;
temp->link=cur;
cur=temp;
}
return cur;
}
| Is This Answer Correct ? | 5 Yes | 4 No |
Post New Answer View All Answers
List the issue that the auto_ptr object handles?
What are advantages of c++?
What is the use of bit fields in structure declaration?
What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?
What is & in c++ function?
Can we make copy constructor private in c++?
In the derived class, which data member of the base class are visible?
What is the type of 'this' pointer? When does it get created?
A prime number is a number which is divisible only by itself and 1. Examples of the first few primes are 2, 3, 5, 7, 11. Consider writing a program which can generate prime numbers for you. Your program should read in and set a maximum prime to generate and a minimum number to start with when looking for primes. This program should be able to perform the following tasks: 1. Read the maximum number from user (keyboard input) to look for primes. The program should not return any primes greater than this number. 2. Read the minimum number from user (keyboard input) to look for primes. The program should not return any primes less than this number. 3. Generate and print out every prime number between the maximum prime and minimum number specified by the user.
How delete [] is different from delete?
Explain stack & heap objects?
Where are setjmp and longjmp used in c++?
What are friend functions in C++?
Describe the advantages of operator overloading?
How would you differentiate between a pre and post increment operators while overloading?