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 8811793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:27:03+00:00 2026-06-14T03:27:03+00:00

Perhaps this is just for showing. While reading K&R, the beginning of 1.7 Functions

  • 0

Perhaps this is just for showing. While reading K&R, the beginning of 1.7 Functions shows an example of a power function. The second line of code declares int power(int m, int n);

Why is the first argument, n, named differently than the first argument, base, in the source of the function:

int power(int base, int n)
{
   ...
}

Is this simply to show that the names do not need to be the same? And should this practice be avoided? Why or why not?

  • 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-06-14T03:27:04+00:00Added an answer on June 14, 2026 at 3:27 am

    The types, and not the names, are what is important in the prototyped declaration. Some people omit the parameter names in the declaration; some use more descriptive names in the declaration (because people may need to read them in the header) than in the function definition. The opposite appears to be the case here; the name in the definition is more meaningful than in the declaration.

    It is purely stylistic. I normally reckon to use the same names in declaration and definition, but sometimes the name needed for the definition (to explain the argument) is too verbose for comfortable use in the function definition.

    See Stroustrup’s “Design and Evolution of C++” for a discussion of why named parameters are not a part of C++. Yes, that’s C++, but the arguments there (primarily unnecessary coupling between declaration and definition) apply to C too.

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

Sidebar

Related Questions

This question is just out of interest, and perhaps could be useful for my
I probably just haven't thought this through, or perhaps I'm simply unaware of an
Perhaps this just sounds ridiculous but I'm wondering is this possible with Ruby? Basically
Perhaps this is an effect of installing the new 4.5 beta, but my simulator
Perhaps this structure is not a good fit for Meteor, or maybe I'm thinking
Perhaps this question has been asked elsewhere, but I'm unable to find it. With
Perhaps this has something to do with it being the mainForm, but I'll ask
I have an ObjectDataSource (but perhaps this question is the same for all kinds
I'm new to visual studio, so perhaps this is something easy... but I've had
Has anyone ever heard of overriding too many classes in Java? Perhaps this issue

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.