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?



program to find middle element of linklist?..

Answer / 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

More C Interview Questions

Convert the following expression to postfix and prefix (A+B) * (D-C)

3 Answers   Satyam,


Is c procedural or functional?

0 Answers  


what is the hexidecimal number of 4100?

16 Answers   Google,


Why should I use standard library functions instead of writing my own?

0 Answers  


Write a program to remove the C comments(/* */) and C++ comments(//) from a file. The file should be declared in command line.

4 Answers   Persistent, Subex,


what is d pitfalls of registers variables

3 Answers   TCS,


what is the difference b/w compiler and debugger?

2 Answers   Assurgent,


There is a number and when the last digit is moved to its first position the resultant number will be 50% higher than the original number.Find the number?

1 Answers  


What is string length in c?

0 Answers  


how to find a 5th bit is set in c program

4 Answers   IBM,


An entire structure variable can be assigned to another structure variable if __________

3 Answers   Sasken, TCS, Tech Mahindra, Wipro,


How can I get back to the interactive keyboard if stdin is redirected?

0 Answers  


Categories