Another problem is that *a and *b are both pointers since a and b are double pointers. So, whatever you assign to *a and *b is the ADDRESS of the variable that will be accessed with **a and **b. Therefore, when you say "*a =" and "*b =", the compiler is expecting an address after the equal signs. However, c and d are intergers, not addresses. If what you want is for **a to be the exact same value as c and for **b to be the exact same value as d, you need to say
That uses the address operator (&) on c and d, which tells the compiler to use the address of c and d, not the actual values of c and d. Here's kinda how the compiler is reading both *a = c and *b = d.
Code:
(pointer) = (interger)
That's where the error "assignment makes pointer from interger without a cast" is coming from. You're assigning an interger value to a pointer value without a cast.
A cast is basically somthing that turns one value into another type of value. If I wanted to use casting to fix that error (which you should note that you do NOT want to do in your particular situation) I would do this.
Code:
*a = (int*)c;
*b = (int*)d;
In that code, (int*) is the cast in both lines. And by putting it in front of c and d you are "casting" those interger values as pointers to an interger.
Again, in your situation you would NOT want to do this. Let's say that c was 20 and d was 30. If you used this code
Code:
*a = (int*)c;
*b = (int*)d;
that would mean that when you used **a, the compiler would use the value stored at the memory address 20, which, 99.99999% of the time, will be memory that has absolutely nothing to do with the program you're writing. If you changed this piece of memory, you could get all kinds of different errors with your computer. The same goes for using **b. That means you're accessing the value stored at the memory address 30, which is most likely being used by some other application or program running on your computer.