Hi I am trying to compile a program and receive 2 errors. One is on line 22 which stats "invalid type argument of aunary" and line 22 "declaration of double pa shadows a parameter". Also on line 26 it states "invalid types double [int] for array subscript. Does anyone have any tips to get started?
Okay thanks I updated it, but do you know why I am getting the 2 error messages line 26 it states "invalid types double [int] for array subscript and In function âvoid extend(double*, double*, double*, int)â:
By declaring q on line 22, you make it impossible to access the q that is the function parameter (this is why it says it "shadows" the parameter). So line 26 is trying to use an array subscript on the q you declared on line 22, which is invalid.
You can fix that by changing the name of the q in you declared in extend(). Also, though this is a small program, it could end badly if you didn't pass an array of doubles, but the address or a pointer to a double variable, because line 22 would increment p to a junk block. You can fix this by taking arrays as the parameter to the function.
Sorry I am not fully understanding if I change the q into something like r then what would r be used for in extend()? Is there any fast fix to get it to at least compile?