Firstly, you do not have to name the members of the structure allocate
memory space to store the string;
Secondly, in your GetStudents function the pointer of the structure should
be an alternative variable, otherwise you will not print the correct
structure, because the structure pointer displacement has occurred, and not
the original location. Similarly printStudents.
"LL" <> ??????

p.unk4ibgccqb7ql@user1-pc...
> #include <stdio.h>
> #include <stdlib.h>
>
> struct Student {
> int id;
> char* name;
> };
>
>
> void getStudents(struct Student*, int);
> void printStudents(struct Student*, int);
>
> main() {
> int n;
> struct Student *s;
> printf("Number of students: ");
> scanf("%d", &n);
> s=(struct Student*)malloc(n*(sizeof(struct Student)));
> getStudents(s,n);
> printStudents(s,n);
> free(s);
> exit(0);
> }
>
> void getStudents(struct Student *s, int n) {
> for (int i=0; i<n; i++) {
> printf("Student Name: ");
> scanf("%s", s->name);
> printf("Student ID: ");
> scanf("%d", &s->id);
> s++;
> }
> }
>
>
> void printStudents(struct Student *s, int n) {
> for(int i=0;i<n;i++) {
> printf("Student Name: %s", s->name);
> printf("ID: %d", s->id);
> s++;
> }
> }