Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- there are some rules to know about pointer assingments and 'const'. it's valid to assign the address of either constant data or non-constant data to a pointer-to-constant:
- */
- double rates[5] = {88.99, 100.12, 59.45, 183.11, 340.5};
- const double locked[4] = {0.08, 0.075, 0.0725, 0.07};
- const double *pc = rates; //valid
- pc = locked; //valid
- pc = &rates[3]; //valid
- // why is the deref symbol '*' used at var declaration but not at subsequent assignments?
- // ex const double *pc;
- // ex *pc = locked;
- // ex *pc = &rates[3];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement