When I try to get user input for the dynamic array, it stops at the first for loop. It gives me an error that my program has stopped working. Help me out!
#include<stdio.h>
#include<stdlib.h>
int main(){
int count = 0, sum = 0, *number = NULL, index = 0, size = 0;
scanf("%d", &size);
number = (int *)calloc(size, sizeof(int)); //Dynamic allocation
printf("Enter the elements\n");
for(index = 0; index < size; index++){
scanf("%d",number[index]); //Getting the input values from user but i get an error
}
return 0;
}