can i know the source code for reversing a linked list with
out using a temporary variable?

Answer Posted / vishnu948923

struct node* reverse(struct node* first)
{
struct 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 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What tq means in chat?

573


Do pointers store the address of value or the actual value of a variable?

602


simple program of graphics and their output display

1462


What is assert and when would I use it?

573


What is bubble sort in c?

627






What is the heap?

677


how to find anagram without using string functions using only loops in c programming

2709


What is typedf?

662


Explain the advantages and disadvantages of macros.

612


What is the best style for code layout in c?

624


Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.

1008


PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

1462


What are unions in c?

569


What does *p++ do? What does it point to?

608


What is structure and union in c?

590