Hello everyone I am working on a c program for a class and I am having issues with calloc. I am using calloc to create a dynamic array and then trying to store elements into that array after initialization. However, after I run my code everytime, I only have zeros in the array.
If anyone could help me out that would be much appreciated. I am really quite stuck because it seems to not make sense. Any help would be awesome. Thanks in advance!
/* Chapter8Homework#3 */
int x = 0, k = 0;
printf("Please enter a number for the size of an array: ");
array_size = (float *)calloc(x, sizeof(float));
printf("Enter a number: ");
scanf("%f", array_size + k);
printf("The number at element %d is %f\n", k, array_size + k);