| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Pointer help please.
I need to pass the value of a pointer from one function to another.
I have it set up like this... void GetTheMoney(); void FigureTheWinnings(int *, int &BetAmount); void GetTheMoney() { int BetAmount, *BetAmt_ptr = &BetAmount; cout << "\nEnter the amount you wish to bet."; cin >> *BetAmt_ptr; } void FigureTheWinnings(int *, int &BetAmount) { cout<< (... i need BetAmount or *BetAmt_ptr here!? ) } i think my protoype format is wrong can anyone show my the correct format. please and thank you! |
|
#2
|
|||
|
|||
|
Quote:
First of all where are you passing the BetAmout?? You are not callingFigureTheWinnings() from GetTheMoney. Also in GetTheMoney() just do : Code:
cin>>BetTheAmount; Since this will automatically give the value of the contents of the pointer. Call to FiguretheWinning() would be Code:
void FigureTheWinnings(BetAmt_Ptr, &BetAmount) ; From within the function GetTheMoney(); |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Pointer help please. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|