Click here to Skip to main content
15,898,588 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralReturn more than one parameter from a single function Pin
CodingLover18-Dec-07 22:48
CodingLover18-Dec-07 22:48 
GeneralRe: Return more than one parameter from a single function Pin
jhwurmbach18-Dec-07 23:18
jhwurmbach18-Dec-07 23:18 
QuestionRe: Return more than one parameter from a single function Pin
CodingLover18-Dec-07 23:26
CodingLover18-Dec-07 23:26 
GeneralRe: Return more than one parameter from a single function Pin
jhwurmbach18-Dec-07 23:30
jhwurmbach18-Dec-07 23:30 
GeneralRe: Return more than one parameter from a single function Pin
Nelek18-Dec-07 23:31
protectorNelek18-Dec-07 23:31 
GeneralRe: Return more than one parameter from a single function Pin
CPallini18-Dec-07 23:56
mveCPallini18-Dec-07 23:56 
GeneralRe: Return more than one parameter from a single function Pin
CodingLover19-Dec-07 0:16
CodingLover19-Dec-07 0:16 
GeneralRe: Return more than one parameter from a single function Pin
Nelek18-Dec-07 23:28
protectorNelek18-Dec-07 23:28 
AFAIK you can not return two parameters at once. You can return a structure having more parameters, you can decide which parameter to return through If, elses. But not to return two different parameters in the same return.

What you are making is giving the 2 Ints as reference to your function, so that when you end and come back to the calling point, you will have the values of your counts in the "parent" scope.

void AnyFunction ()
{
   int nChar = 0;
   int nWord = 0;

   string rtf = GetYourString ();

   bool bRet = CharWordCount(rtf, &nWord, &nChar);

   printf ("there are %d words and %d characters in the string", nWord, nChar);
}


what you have to code inside the function CharWordCount () is in the answers of your question of yesterday or 2 days ago.

Greetings.
--------
M.D.V. Wink | ;)

If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

GeneralRe: Return more than one parameter from a single function Pin
CodingLover18-Dec-07 23:43
CodingLover18-Dec-07 23:43 
GeneralRe: Return more than one parameter from a single function Pin
Nelek19-Dec-07 0:24
protectorNelek19-Dec-07 0:24 
QuestionRe: Return more than one parameter from a single function Pin
Hamid_RT19-Dec-07 1:33
Hamid_RT19-Dec-07 1:33 
GeneralRe: Return more than one parameter from a single function Pin
CPallini19-Dec-07 2:17
mveCPallini19-Dec-07 2:17 
GeneralRe: Return more than one parameter from a single function Pin
David Crow19-Dec-07 3:00
David Crow19-Dec-07 3:00 
Questionvc++ to actionscript Pin
aravindakumar18-Dec-07 22:31
aravindakumar18-Dec-07 22:31 
QuestionRe: vc++ to actionscript Pin
Nelek18-Dec-07 22:39
protectorNelek18-Dec-07 22:39 
GeneralRe: vc++ to actionscript Pin
aravindakumar18-Dec-07 23:04
aravindakumar18-Dec-07 23:04 
GeneralRe: vc++ to actionscript Pin
Nelek18-Dec-07 23:10
protectorNelek18-Dec-07 23:10 
GeneralRe: vc++ to actionscript Pin
aravindakumar18-Dec-07 23:08
aravindakumar18-Dec-07 23:08 
GeneralRe: vc++ to actionscript Pin
msr_codeproject25-Dec-07 21:59
msr_codeproject25-Dec-07 21:59 
GeneralApplication Crash error Pin
Atul2318-Dec-07 21:26
Atul2318-Dec-07 21:26 
GeneralRe: Application Crash error Pin
Don Box18-Dec-07 21:32
Don Box18-Dec-07 21:32 
GeneralRe: Application Crash error Pin
CPallini18-Dec-07 21:46
mveCPallini18-Dec-07 21:46 
GeneralRe: Application Crash error Pin
Peter Weyzen18-Dec-07 21:53
Peter Weyzen18-Dec-07 21:53 
GeneralRe: Application Crash error Pin
Nelek18-Dec-07 22:22
protectorNelek18-Dec-07 22:22 
GeneralRe: Application Crash error Pin
Hamid_RT18-Dec-07 22:54
Hamid_RT18-Dec-07 22:54 

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.