0
所以,我在C函數中得到這個錯誤。C錯誤:類型'int *'和'unsigned int'到二進制'運算符*'的操作數無效|
變量:
int* first_array = (int*) malloc(0);
int first_array_length;
int* second_array = (int*) malloc(0);
int second_array_length;
// Setting up first array
set_up_array(first_array, &first_array_length);
這是一個功能:
void set_up_array(int *arr, int *num)
{
char lenght_msg[] = "Iveskite masyvo ilgi";
char value_msg[] = "Iveskite masyvo elementa";
*num = num_scan(0, MAX_SIZE, lenght_msg);
arr = (int*) realloc(arr, num * sizeof(int)); // <- error here
for (int i = 0; i < (*num); i++)
{
arr[i] = num_scan(INT_MIN, INT_MAX, value_msg);
}
}
請幫助!
錯誤:
invalid operands of types 'int*' and 'unsigned int' to binary 'operator*'|
'int * arr' - >'int ** arr'因爲它不反映變化。 – BLUEPIXY 2013-05-05 16:44:32