Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Which is the better implementation?

Name: Anonymous 2014-09-05 19:47

int main()
{
printf("5+6=%d", 5+6);
return 0;
}


Or

////////////////////////////////////////
// AddNumbers
// param1 firstParam - The first value to add
// param2 secondParam - The second value to add
// return - The firstParam added to the secondParam
//
int addNumbers( int firstParam,
int secondParam )
{
// Here is some info
int theReturn = firstParam + secondParam;

// Now return the value
return theReturn;
}

// Entry for program
int main()
{
// Initialize variables
int firstParam = 5;
int secondParam = 6;

// Call the function
int returnValue = AddNumbers( firstParam, secondParam );

// Print out the value
printf("%d+%d=%d", firstParam, secondParam, returnValue );

return 0;
}

Name: Anonymous 2014-09-05 19:52

Most people call two numbers added together a ``sum'', not a ``returnValue'', that just sounds stupid.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List