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

How are 16- and 32-bit numbers stored?

1236


why wipro wase

2245


Are the variables argc and argv are local to main?

1249


What is structure of c program?

1071


Explain what does the function toupper() do?

1003


What is call by value in c?

950


How can you find the day of the week given the date?

1145


Explain what happens if you free a pointer twice?

1010


Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?

982


Why main is used in c?

1008


What is a header file?

1026


Explain what standard functions are available to manipulate strings?

1022


What is the basic structure of c?

1008


How can I read/write structures from/to data files?

921


Is it better to use malloc() or calloc()?

1054