Hello again!
I'm working on an assignment to compute income tax.
I decided to use a multi dimensional array with the numbers I was given to process. I declared and initialized my array, and I am getting the following error:
Error 1 error C2040: 'wages' : 'double [6][5]' differs in levels of indirection from 'double'
Here is my code:
I double checked several resources, including the tutorial here, and it looks like I initialized it properly. I looked up the error and here is the definition:
"If both operands are arithmetic or both are nonarithmetic (such as array or pointer), they are used without change. If one operand is arithmetic and the other is not, the arithmetic operator is converted to the nonarithmetic type."
I don't understand the error at all.
Secondly, to desk check my array I wanted to print it out to verify it was working properly before I moved on with my program. I used a nested FOR loop, and I am getting the following errors:
Error 2 error C2109: subscript requires array or pointer type
3 IntelliSense: expression must have pointer-to-object type
Here is my code:
I've been researching for about an hour and I can't figure out what I'm doing wrong. And advice would be appreciated! Thank you.
I'm working on an assignment to compute income tax.
I decided to use a multi dimensional array with the numbers I was given to process. I declared and initialized my array, and I am getting the following error:
Error 1 error C2040: 'wages' : 'double [6][5]' differs in levels of indirection from 'double'
Here is my code:
//declare/init master tax array double wages[6][5] = { {6000.00,2.8, 0.0, 2.3, 0.0}, {10000.00, 7.5, 5.2, 7.2, 3.8}, {15000.00,9.6,8.3,8.9,7.4}, {20000.00,13.5,12.2,13.1,11.0}, {25000.00,15.5,14.6,15.2,13.8}, {35000.00,17.4,16.3,17.2,15.4} };//END ARRAY INIT
I double checked several resources, including the tutorial here, and it looks like I initialized it properly. I looked up the error and here is the definition:
"If both operands are arithmetic or both are nonarithmetic (such as array or pointer), they are used without change. If one operand is arithmetic and the other is not, the arithmetic operator is converted to the nonarithmetic type."
I don't understand the error at all.
Secondly, to desk check my array I wanted to print it out to verify it was working properly before I moved on with my program. I used a nested FOR loop, and I am getting the following errors:
Error 2 error C2109: subscript requires array or pointer type
3 IntelliSense: expression must have pointer-to-object type
Here is my code:
for(int x=0;x<6;x++) { for (int y=0;y<5;y++) printf("%d\n", wages[x][y]); }
I've been researching for about an hour and I can't figure out what I'm doing wrong. And advice would be appreciated! Thank you.