Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Implement a function that returns the 5th element from the
end in a singly linked list of integers in one pass.

Answer Posted / a.eklare7

int fifth_element_last(node *head)
{
node *p;
int len=0;
p=head;
while(p->next!=NULL)
{
p=p->next;
len++;
}
p=head;
for(int i=1;i<=len-4;i++)
p=p->next;
return(p->data);
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are local variables c?

1028


struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer

1300


What are data types in c language?

1062


will u please send me the placement papers to my mail???????????????????

1841


How do you list a file’s date and time?

1074


What do you mean by invalid pointer arithmetic?

1088


What is a void pointer? When is a void pointer used?

1065


Define circular linked list.

1040


What is hungarian notation? Is it worthwhile?

1231


What are enums in c?

1211


Why header file is used in c?

1098


I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.

2373


Write the Program to reverse a string using pointers.

1029


How many levels deep can include files be nested?

1144


What is preprocessor with example?

1070