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...

program to find middle element of linklist?

Answer Posted / abdur rab

struct node {
int data;
struct node* next;
};

int mid_element ( struct node* _node )
{
struct node* cur_ptr;
struct node* cur_next_ptr;

if ( NULL == _node ) return ( -1 );
else {
cur_ptr = _node;
cur_next_ptr = _node;
while ( ( NULL != cur_ptr -> next )
&& ( NULL != cur_next_ptr -
> next )
&& ( NULL != cur_next_ptr -
> next -> next ) )
{
cur_ptr = cur_ptr -> next;
cur_next_ptr = cur_next_ptr ->
next -> next;
}
}

return ( cur_ptr -> data );
}

Is This Answer Correct ?    8 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is malloc calloc and realloc in c?

1321


Stimulate calculator using Switch-case-default statement for two numbers

2986


Write a program to use switch statement.

1129


What is boolean in c?

1088


What is the difference between volatile and const volatile?

983


How to get string length of given string in c?

1067


What are the similarities between c and c++?

1068


largest Of three Number using without if condition?

1597


difference between Low, Middle, High Level languages in c ?

2081


How to draw the flowchart for structure programs?

9336


Is register a keyword in c?

1040


develop algorithms to add polynomials (i) in one variable

2163


Is return a keyword in c?

1075


a c code by using memory allocation for add ,multiply of sprase matrixes

2796


How can you draw circles in C?

1156