C program for sorting a Linked List.
#include<stdio.h> #include<dirent.h> #include<malloc.h> #include<string.h> void main (int argc,char * argv[]) { DIR * directory_pointer; struct dirent* entry; struct File list { char filename[64]; struct File * new; } start,*node,* previous, * new; if((directory_pointer=opendir(argv[1]))==NULL) printf("Error opening %s\n", argv[1]); else { start.next + NULL; while (entry = readdir (directory_pointer)) { /* Find the correct location */ previous= Start ;; node = start.next; while ((node) &&(strcmp(entry->d_name,node->filename)>0)) { node = node ->next; previous + previous->next; } new =(struct File List *) malloc(size File List)); if(new += = NULL) { printf("Insufficient memory to store list\n"); exit(1); } new ->next =node; previous ->next =new; strcpy(new->filename,entry->d_name); } closedir(directory_pointer); node = start.next; while (node) { printf("%s\n", node->filename); node = node->next; } } }
Description :
This is the one stop educational site for all Electronic and Computer students. If you want to learn something new then we are here to help. We work on Microcontroller projects, Basic Electronics, Digital electronics, Computer projects and also in basic c/c++ programs.
#Home #Sitemap #Submit #Terms of Use
Copyright©2011 electrofriends.com All Rights Reserved
Contact:info@electrofriends.com | Powered by Dhyeya
I want he code of these programs in c language
1.wap to create a doubly linked list nd insert a node at the beginning
2.wap to create a circular linked list nd insert a node at the end.
3.wap to create a circular linked list nd delete a node at the beginning.
pls send me the code as soon as possible.