Untitled
unknown
plain_text
a year ago
559 B
22
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);
}Editor is loading...
Leave a Comment