Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- typedef struct node{
- int info;
- struct node *next;
- }node;
- node *cll(node *h);
- int main(){
- node *head;
- head=(node*)malloc(sizeof(node));
- head->next=NULL;
- cll(head);
- // display(head);
- }
- node *cll(node *h){
- int n;
- // node *temp;
- node *ptr;
- int i, n1;
- printf("how many\n");
- ptr=h;
- scanf("%d",&n);
- n1=n;
- printf("enter %d val\n ", n);
- while ( n -- > 0){
- scanf("%d", &ptr->info);
- ptr->next=(node*)malloc(sizeof(node));
- ptr=ptr->next;
- ptr->next=NULL;
- }
- ptr=h;
- for(i=0;i<n1;i++)
- {
- printf("%d\n", ptr->info);
- ptr=ptr->next;
- }
- return (h);
- }
Add Comment
Please, Sign In to add comment