Updated your code and posted below.
This works for me try.
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
int main(int agrc,char * argv[]) {
// Create null pointers
char * students = 0;
int * grades = 0;
int * namelen = 0;
// Variable to track class size
int classSize = 0;
printf("Please enter the class size: ");
scanf("%d",&classSize);
printf("Class size = %d\n",classSize);
// Allocate the memory for the null pointers
students = malloc(classSize * 20);
grades = malloc(classSize * sizeof(int));
namelen = malloc(classSize * sizeof(int));
int i = 0;
char tmp[20];
int pos = 0;
for(;i<classSize;i++) {
printf("Please enter student %d's name: ",i+1);
// Read name into dummy variable
scanf("%s",tmp);
// Store the length of the name
*(namelen + i) = strlen(tmp);
// Read in the name of the student
strcpy(students+pos,tmp);
printf("Please enter %s's grade: ",students + pos);
// Read in the grade of the student
scanf("%d",grades+i);
pos += *(namelen+i)+1;
}
printf("\n");
printf("The data that you entered is as follows:\n");
printf("----------------------------------------\n");
i = 0;
pos = 0;
for(;i<classSize;i++) {
printf("Student %d: %s. Grade: %d\n",i+1,students+pos,*(grades+i));
pos += *(namelen+i)+1;
}
}