[General Help][SOLVED] Dynamic Arrays and General Pointer syntax
Hello, before I go further I would like to state that this is not for a homework assignment, but I would still prefer if I wasn't given the answer right off the bat. My goal is to write a very simply program that asks for a user input for the size of an array, adjusts the size, asks the user to input values and then prints out those values. I would prefer to split some of this up into functions, leaving as little in main as possible (I've been told that it's more efficient to do this).
My Code:
Code:
#include <stdio.h>
#include <stdlib.h>
#define CRT_NO_DEPRECATE
void hurrdurr (double * array[], int size);
int main (void)
{
int *array, size;
printf("Enter the size of the array\n");
scanf("%i", &size);
array = (int*) malloc( size*sizeof(int));
printf("Enter some numbers");
hurrdurr (&array, size);
return 0;
}
void hurrdurr (int *array[], int size)
{
int i;
for (i = 0; i < size; i++)
{
scanf("%lf", &array[i]);
}
}
I'm totally aware that my syntax isn't correct, but I also have very limited C experience. In fact, if my entire way of going about doing this isn't very good, by all means let me know.
Thanks for any answers in advance, and I'll be as prompt as possible with replies.