Click here to Skip to main content
15,914,417 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: system info Pin
Ryan Binns10-Oct-04 18:16
Ryan Binns10-Oct-04 18:16 
GeneralRe: system info Pin
Graham Bradshaw11-Oct-04 0:43
Graham Bradshaw11-Oct-04 0:43 
GeneralRe: system info Pin
Ryan Binns11-Oct-04 14:33
Ryan Binns11-Oct-04 14:33 
GeneralRe: system info Pin
Aamir Butt11-Oct-04 0:11
Aamir Butt11-Oct-04 0:11 
GeneralRe: system info Pin
Graham Bradshaw11-Oct-04 0:48
Graham Bradshaw11-Oct-04 0:48 
GeneralRe: system info Pin
Abbas_Riazi11-Oct-04 7:35
professionalAbbas_Riazi11-Oct-04 7:35 
GeneralFunctions in Structures !?! Pin
QuasarZ !?!10-Oct-04 6:04
sussQuasarZ !?!10-Oct-04 6:04 
GeneralRe: Functions in Structures !?! Pin
Antti Keskinen10-Oct-04 9:10
Antti Keskinen10-Oct-04 9:10 
1. The question is not phrased reasonably. But this is how I understand it "How can I call a function inside a structure ?" and "How can I determine the location where the return value is stored ?"

For the first, calling a function inside a structure is just like calling any other function, the difference is that you need to have an object of the structure and use the member-of operator (. or ->). An example:
struct coins
{
   void Function1(void) {}
   void Function2(void) {}
};<DIV>

int main(void)
{
   coins objCoin;
   objCoin.Function1();  // Call first function
   objCoin.Function2();  // Call second function<DIV>

   return 0;
}
In your code piece, the Convert_To_Denom function will not work, because you have not initialized the pointer 'mac' before passing it as a function parameter. What you are doing is declaring a pointer-to-struct type, but you're not assigning it i.e. it does not point anywhere. If you use this pointer as is, the program will cause a run-time error. To make the code work, you must remove the asterisk from the declaration of 'mac'. This way, you will create an object of structure 'machine', and pass the address of this object into the function, which will then use the created pointer to access the members ten, twenty and fifty of the structure.

For the second question, you can nest function calls inside each other, if the return values and parameter types match. An example:
int Function1(void) { return 1; }
void Function2( int nValue ) { printf("%d", nValue); }<DIV>

int main(void)
{
   Function2( Function1() );<DIV>

   return 0;
}

Does this answer your questions ? If not, rephase your question, spell check it and write it in clear, plain english. Do not use abbreviations or other things which might leave your question unclear to other readers. For example, the 'qn' does not mean anything unless you can decipher it from the sentence context. If the sentence context is unclear or mistyped, the entire idea of the sentence (and thus your question) will be ruined.

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
Questionstreaming wav on the web through activeX control? Pin
FASTian10-Oct-04 5:06
FASTian10-Oct-04 5:06 
AnswerRe: streaming wav on the web through activeX control? Pin
Ravi Bhavnani10-Oct-04 7:13
professionalRavi Bhavnani10-Oct-04 7:13 
Generalnew Items in my Toolbox Pin
Serhiy10-Oct-04 4:55
Serhiy10-Oct-04 4:55 
GeneralRe: new Items in my Toolbox Pin
Aamir Butt11-Oct-04 0:15
Aamir Butt11-Oct-04 0:15 
GeneralRe: new Items in my Toolbox Pin
Serhiy11-Oct-04 0:49
Serhiy11-Oct-04 0:49 
Questionhow to set list height of the listctrl? Pin
Lido Paul10-Oct-04 4:46
Lido Paul10-Oct-04 4:46 
AnswerRe: how to set list height of the listctrl? Pin
Ravi Bhavnani10-Oct-04 7:16
professionalRavi Bhavnani10-Oct-04 7:16 
GeneralFile Properties in Windows XP Pin
dessa9910-Oct-04 2:29
dessa9910-Oct-04 2:29 
GeneralRe: File Properties in Windows XP Pin
Antti Keskinen10-Oct-04 10:12
Antti Keskinen10-Oct-04 10:12 
GeneralDisabled menu item Pin
Kamis10-Oct-04 2:24
Kamis10-Oct-04 2:24 
GeneralRe: Disabled menu item Pin
Antony M Kancidrowski10-Oct-04 3:03
Antony M Kancidrowski10-Oct-04 3:03 
GeneralRe: Disabled menu item Pin
Kamis10-Oct-04 3:43
Kamis10-Oct-04 3:43 
GeneralEdit control, SDI Pin
uqtur10-Oct-04 0:58
uqtur10-Oct-04 0:58 
GeneralVirtual CD Pin
X20409-Oct-04 23:55
X20409-Oct-04 23:55 
QuestionHow to register? Pin
momer9-Oct-04 23:06
momer9-Oct-04 23:06 
QuestionHow to store the greatest number value? Pin
sacoskun9-Oct-04 22:38
sacoskun9-Oct-04 22:38 
AnswerRe: How to store the greatest number value? Pin
Antony M Kancidrowski10-Oct-04 3:01
Antony M Kancidrowski10-Oct-04 3:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.