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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:22:41+00:00 2026-05-26T05:22:41+00:00

Whats the difference between an init-declarator and declarator in C++? An init-declarator may appear

  • 0

Whats the difference between an init-declarator and declarator in C++? An init-declarator may appear in init-declarator-list. Example:

int x, y, z;

or

  int x;
  int y;
  int z;

where x, y, z may be the init-declarators or should i say declarators?

  • 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-26T05:22:41+00:00Added an answer on May 26, 2026 at 5:22 am

    Here is the grammar:

    init-declarator-list:
           init-declarator
           init-declarator-list , init-declarator
    init-declarator:
           declarator initializeropt

    That is, init-declarator-list may contain declaration of more than one variable, and init-declarator must contain declaration of exactly one variable.

    That means, in your case, the first code is init-declarator-list and second code is init-declarator (and init-declarator-list both, since init-declarator-list may contain just one declaration).

    But how does it matter what you call what? In everyday use, this difference is almost ignorable.

    However, if you want to know about coding-style, then different people declare variables differently. I’ve seen many good programmers who use both style. I usually write all related variables in the same declaration-list, e.g

    int x,y,z; //point coordinates
    int height, width; //dimensions
    std::string firstname, lastname; //name parts
    int left, top, right, bottom; //rectangle coordinates
    

    If you group them as above, it is easier for one to understand the meaning of each variables just by recognizing the group first. It is also easier to use just one comment for each declaration-list (exactly as I did above!) and you’re done. It also helps maintenance to some extent, probably not that much though.

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

Sidebar

Related Questions

I'm wondering what the difference is between (add-to-list 'flymake-allowed-file-name-masks '(\\.py\\' flymake-pylint-init)) and (add-to-list flymake-allowed-file-name-masks
Whats the difference between: @interface SomeClass : NSObject { NSObject *something; } and @interface
Whats the difference between Cast & Convert in C# 2008?
Whats the difference between SELECT DISTINCT field1 FROM table1 cd JOIN table2 ON cd.Company
Whats the difference between Url.Action and Html.RenderActionLink in asp.net mvc?
Duplicate Whats the difference between declaring as new and as something new something i
I would like to ask whats the difference between for row in session.Query(Model1): pass
As the title says, whats the difference between MyFunction = function() { } and
With regards to SQL and queries, whats the difference between an in-memory table, temp
delegate void DelegateTest(); DelegateTest delTest; Whats the difference between calling delTest.Invoke() and delTest() ?

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.