• Advertisement

Archived

This topic is now archived and is closed to further replies.

Parameter list?? Need a hand!

This topic is 6525 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, Ok, In my main fuction I have ifstream infile; int site; int NumReadings; float average; Now in a function called Process site I am supposed to transverse the dat file infile and then return the values for NumReadings and average and also infile itself....it says to return these guys with a parameter list?? This is probably a stupid question but what is a parameter list and how do I return 3 variables from one function without making the variables global? Any help would be appreciated...thanks -Tim

Share this post


Link to post
Share on other sites
Advertisement
sending informastion through parameter lists are usually done with pointers to original objects.

main()
{
char infile[20];
int site;
int Numreadings;
float average;

ProcessSite(infile, &site, &numreadings, &average);
}


// all pointer to the differnt types
int ProcessSite(char *SentFileName, int *SentSite, int *Sentnumreadings, float *Sentaverage)
{
fopen(SentFileName,..); // char strings are slightly different

}

Basically you are going to have to know how pointers work. With-out that knowledge you won''t get far in anything.
Get ANY book on the C or C++ basic and it''ll be in it.


ZoomBoy
A 2D RPG with skills, weapons, and adventure.
See my character editor, Tile editor and diary at
Check out my web-site

Share this post


Link to post
Share on other sites
Thanks!

Yeah, I have basically a small library of c++ and game dev books....but I have gotten this far without reading much of them , guess I should sit down and work through em.

Share this post


Link to post
Share on other sites
You might also check out references. It''s in C++ and you pass a reference to a function; it''s like an alias


ZoomBoy
A 2D RPG with skills, weapons, and adventure.
See my character editor, Tile editor and diary at
Check out my web-site

Share this post


Link to post
Share on other sites
I wouldn''t use references though, if you''re going to introduce side-effects (you''re changing the values of the variables passed to the function as arguments), since it''s not as obvious (you''ll understand when you read about it)


Share this post


Link to post
Share on other sites

  • Advertisement