CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS LANGUAGES C DETAILS
Question :
c program for delete a node from linked list



Category C Interview Questions
Rating (0.0) By 0 users
Added on 7/18/2006
Views 801
Rate it!
Answers:

struct node

{

int data;

struct node * next;

}list;

for deleting a node from list first we have read a element which u want to delete and then we have identify previous node of that element.

scanf("%d",&x);

void deletenode(struct node * list)

{struct node * l1=list,temp;

if (l1->data==x) l1=l1->next; //deleting first element

else

{

while (l1->next->data!=x) and (l1!=NULL) l1=l1->next;

temp=l1->next; //here l1 points to previous node

l1->next=l1->next->next;

delete (temp)

}

}





If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
What is the differece between #define and constant in C?

View Answer
How can we open a image file through C program

View Answer
In c , main() is a function . and where is defined main() in c. bcz every function has three parts.
1>. decleration
2>. definition.
3>. calling

View Answer
What is wrong with the following c program?
char *s1 = "hello";
char *s2 = "world";
char *s3 = strcat(s1, s2);

Please provide me explanations??

View Answer
Between a long pointer and a char pointer , which one consumes more memory? explain

View Answer
What does it mean-

a[i]=i+i

View Answer
How to break cycle in circular single link list?

View Answer
How to improve my c knowledge........

View Answer
How do you write a program which produces its own source code as its output?

View Answer
How to write a C program to find the power of 2 in a normal way and in single step?

View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/5954/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.72