To allocate memory on heap for an array: int* numbers = malloc( sizeof(*numbers) * num_numbers ); ↑ ↑ ↑ │ ASTERISK │ │ │ │ │ └────────────┬──────────────┘ variable name for address of new array on heap DO NOT use … = malloc(sizeof(int)) … OR … … = malloc(sizeof(«TYPE»)) Although it will compile and work, it is bad practice because it makes code more vulnerable to bugs in the future.