Im programming in c VS 2013
im trying to multiplicate the a[i] num by 10 raised by (max -1 -i). when max is the size of array, and i is initialed for (max -1). im using a for loop, i--.
im using the pow() function, and therefor had to define i as a float, or a double. Maybe max too, but it doesnt give me an error.
int sum = 0;
float j = 0, i;
int max;
printf("Enter number of digits: ");
scanf_s("%d", &max);
int *a;
a = (int *)malloc(max * sizeof(* a));
for (i = 0; i < max; i++)
{
printf("\nEnter the %d digt: ", i + 1);
1 scanf_s("%d", &a[i]);
}
for (i = max - 1; i >= 0 ; i--)
{
2 sum = sum + a[i]*pow(10, max -1 -i);
j++;
}
When trying to compile, it gives me an error at lines 1 and 2.. pointing on [i] and saying that expression must have integral or unscoped enum type
the (max - 1 -i) b.t.w is instead of an extra variable.. im trying to minimize them
help?