i have just started ad my study and has been introduced to c++, just a week ago, and i struck something that irritates me: i have a base code like this
double a,b,c;
cout<<"please add in your values"<<endl;;
cout<<"a :";cin>>a;
cout<<"b :";cin>>b;
cout<<"c :";cin>>c;cout<<"\n";
dis(a,b,c);
return 0;
now i have also created a function (by the name dis) which look like this
void dis(double a,double b, double c){
double d;
double* p=&d;
d=(pow(b,2))-(4)*(a*c);
cout<<"result: "<<d;
cout<<*p;}
now i do know how to implement my result - but the way it has to be done gets on my nerves - so i wanted to create a pointer so that i can snatch up the address of the value and create a new int which is equal to the value stored on the address
Now comes my question
if i know an address for any value then how can i refer to it form my "main" so that i can create an int that contains the answer instead of doing like it is normaly done ?
I hope you know what i mean :D