Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
559 B
8
Indexable
#include <stdio.h>
#include <stdlib.h>
    struct node {
        int data;
        struct node *next;
    }*start=NULL;
    
    void createll(int n){
        struct node *ptr=(struct node*)malloc(n*sizeof(struct node));
         ptr->next=NULL;
        for(int i=0;i<n;i++){
            scanf("%d",(ptr+i)->data);
            (ptr+i)->next=(ptr+i+1);
        }
            (ptr+(n-1))->next=NULL;
        
        for(int i=0;i<n;i++){
            printf("%d",(ptr+i)->data);
        }
    }
    void main() {
    int n;
    scanf("%d",n);
    createll(n);
}
Leave a Comment