Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6727403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:02:43+00:00 2026-05-26T10:02:43+00:00

I have some parameters in my functions that receive and pass around the same

  • 0

I have some parameters in my functions that receive and pass around the same value. Should I name all the parameter variables the same?

Example:

// assume numMonth = 12
// assume numYear = 2000

int promptMonth(); // returns numMonth
int promptYear();  // returns numYear

int daysInMonth(int numMonth, int numYear); // numMonth and numYear will always
int daysInYear(int numYear);                // be sent to these.

bool isLeapYear(int numYear);               // daysInYear() and daysInMonth() call
                                            // this function and send it numYear 
                                            // (which would be 2000 in this case).

Should all those parameters be named the same since the same value is passed to each of them?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:02:44+00:00Added an answer on May 26, 2026 at 10:02 am

    By same, I assume you mean the function parameter name numYear.

    Yes it is always good practice to name the variables in a meaningful way which indicates the meaning/purpose of the value being passed.

    And those variables are part of different functions, hence there scope is limited to those functions only, So there is no problem of multiple definitions if you are thinking of that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some XML code that looks like this <SEARCHRESULTS> <FUNCTION name=BarGraph> <PARAMETER name=numList></PARAMETER>
I have some special parameters to all my wcf service methods that are handled
I would like to have a function that modifies some variable list of parameters
I have some Perl code that executes a shell script for multiple parameters, to
I have a C++ library that should expose some system\ resource calls as callbacks
I have a vps with cPanel/Whm/CentOS 5.5 and the problem is that all parameters
I have a JS function that selects some elements based on the parameters function
I have some Matlab functions that I have to translate in C but I
Suppose I have arbitrary template method, which could receive parameters by value and by
I have some questions about the default values in a function parameter list Is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.