Im trying to write a program and am having trouble linking I can link my array with char* fine but not int?
why is that it keeps saying
error C2109: subscript requires array or pointer type.
Im pretty sure it an obvious error but cant seem to find it.
I thought it was the * but not sure where excatly it goes!
Do I have to star all through the previous classes that it links with or just within the question section.
If I ask through the question section I then get this error
error C2664: 'COMPUTER::COMPUTER(char *,int,float,char *,long double,float,char *,int,int,float)' : cannot convert parameter 2 from 'int *' to 'int'
Every time you are declaring a pointer you should add a * after the type
That error tells you that you are passing a int* (pointer to int) where the function takes an int.
If you want the function having an int* argument add there a *: COMPUTER::COMPUTER(char *,int*,float,char *,longdouble,float,char *,int,int,float)
If you int as argument type is right, when passing the variable use the reference operator ( & )
Sorry cant remember what the message was, but I decleared it under a int then used it later as a float so I had to change what i declared as a float and not int.
I now have this problem
cout << "What specification would you like to view "; //Displays A Task title.
cin >> Z; // Stores Entered Values.
A = new (nothrow) int[Z]; //
if (A == 0) //
cout << "Error"; //
else
for (Y=0; Y<Z; Y++) //
cout << A [Y]<< ""; //
this error refers to line 3
error C2440: '=' : cannot convert from 'int *' to 'int *[10]'