Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct StudentInfo{
        unsigned int roll;
};

typedef struct StudentInfo StdInfo;

int main(int argc, char** argv){
        StdInfo* students;
        unsigned int size = 3, i=0, j;
        unsigned short int s = 1;
        char* dump_name;

        students = malloc( size*sizeof(StdInfo) );

        do{
                printf("Enter Roll of Student %d :\t", i);
                scanf("%d", &(students[i].roll));
                printf("\n\nEnter another ? (1/0):\t");
                scanf("%d", &s);
                if(s == 1){
                        size *= 2;
                        students = realloc( students, size*sizeof(StdInfo) );
                }
                i++;
        }while(s == 1);

        free(students);
        students = 0x0;

        return 0;
}
Why does the above code Crashes. I suspect its caused by realloc But how to solve it ?