I need to make a table of numbers starting from 3, index going from 0 to 29 so that every number gets multiplied by two. So the table should look like:
3 6 12 24 48 96 ....
This is what I got and it doesn't work at all..
void show_table(long int *a, size_t n)
{
int i;
for (i = 0; i < n; ++i) {
printf("%ld ", a[i]);
*a = *a *2;
}
}
int main(void)
{
long table[] = {3};
show_table(table, 29);
}
