Untitled
unknown
plain_text
a month ago
559 B
8
Indexable
Never
#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