differentiate pointer to multiplication

some one please try to help.. i have this declaration of a variable 'a'

a= (variable 'b') x (value pointed by 'c')

when im doing this:

a=(*c) * b;

i get error!

illegal indirection...
Post the code.
do you mean you have something like this?
1
2
3
4
int b = 10;       // Make a variable and set the value to 10
int* c = &b;      // Making a pointer c and setting it to the address of b.

int a = (*c) * b; // a gets the value at c times b 


This works for me. We'll need to see how the variables are defined and initialized if you'd like anything further.
Last edited on
vector<int>::iterator it;
vector<int>::iterator ip;


it=vectorquant.begin();


for ( ip=vectorprodnum.begin() ; ip < vectorprodnum.end(); ip++ )
{

cout<<" "<<pn[*ip]<<" "<<*it<<" "<<up<<" "<<amt<<"\n";
it++;

}

up refers to a data structure created before this code...

i used this:

int amt;
int* qty=&up;

amt= (*qty) * up;

and it print out well at ip, it and up. but in amt, it only print out 0.
Topic archived. No new replies allowed.