Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C Compiler.
- Code, Compile, Run and Debug C program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <stdio.h>
- struct Node
- {
- int key;
- struct Node* next;
- struct Node* pre;
- };
- struct List
- {
- struct Node* end;
- struct Node* current;
- struct Node* start;
- };
- struct Node arr2[100];
- struct Node* arr1[5];
- //for(int i=0; i<5;i++)
- //{
- // arr1[i]=NULL;
- //}
- struct List* ListCreate()
- {
- int i;
- for (i=0; i<5;i++)
- {
- if(arr1[i]!=NULL)
- {
- continue;
- }
- else
- break;
- }
- if( i>= 5)
- return NULL;
- //printf("%d",i);
- struct List bbart;
- struct Node c;
- c.key=5;
- c.next=NULL;
- bbart.start=&c;
- struct List* d;
- arr1[i]=bbart.start;
- d=&bbart;
- return d;
- }
- int ListCount(struct List A)
- {
- struct Node* temp=A.start;
- //printf("%d", A.start->key);
- int count=1;
- while(temp->next!=NULL)
- {
- count++;
- temp=temp->next;
- }
- return count;
- }
- int main()
- {
- for(int i=0; i<5;i++)
- {
- arr1[i]=NULL;
- }
- //struct Node x;
- //arr1[0]=&x;
- struct List* A= ListCreate();
- struct Node e;
- e.key = 8;
- e.next = NULL;
- A->start->next = &e;
- //printf("%d", A->start->key);
- //ListCreate();
- //struct Node arr2[100];
- //struct Node* arr1[5];
- //ListCreate
- //printf("Hello World");
- struct List C;
- C.start->key=(*A).start->key;
- C.start->next=(*A).start->next;
- int a=ListCount(C);
- struct List* B= ListCreate();
- printf("%d",a);
- //printf("%d", B->start->key);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement