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

  • Home
  • SEARCH
  • 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 8311227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:44:28+00:00 2026-06-08T19:44:28+00:00

After learning from this question that in C++ It is okay to put the

  • 0

After learning from this question that in C++ It is okay to put the name of the variable in parenthesis
I tried this program:

#include <iostream>
int main()
{
    int (a)();
    std::cout << "if this works then deafult value of int should be " << a << std::endl;
    return 0;
}

And got output of ‘if this works then deafult value of int should be 1’
So, is this true?

EDIT::
After reading @james-mcnellis answer when i tried to assign a value to a, it gives an error as assignment of function ‘int a()’.

so now it is clear that here a is a function not the variable.

  • 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-08T19:44:29+00:00Added an answer on June 8, 2026 at 7:44 pm

    a is not an int: it is a function that has no parameters and returns an int. Because it is a function declaration, a is also not a local variable and it does not have a “default value.”

    The program is ill-formed because you never define the function a but you attempt to use it (by taking its address in the insertion expression). It therefore violates the one definition rule.

    If you define a in the program, 1 will be printed because the address of the function a will be converted to bool: the operator<< overload that has a bool parameter is the best match for the function pointer argument type.

    [Note: if you define a and compile with Visual C++, it will print the address of the function, not 1. This is (I think) because Visual C++ allows a function pointer to be implicitly converted to void*, and then the operator<< overload that has a void const* parameter is the best match for the function pointer argument type. If you compile with language extensions disabled (/Za), the overload with a bool parameter will be selected as expected.]

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

Sidebar

Related Questions

I'm learning how to traverse the DOM so this question is related to that.
I am learning OpenGL from this tutorial . My question is about the specification
I installed Visual Studio 2012 Ultimate RC this morning after learning about IntelliTrace at
Hello to all that read I am self learning C++ from a text book:
I took this code from Facebook's documentation to get me started in learning how
I'm learning C, but after that or in the meanwhile, what should I learn
I am learning javascript sample from this page and I am using IE 7
I come from a microcontroller programming world, and I am learning to program on
I've recently started learning HLSL after deciding that I wanted better lighting than what
I'm still learning Android Development so sorry if this question seems stupid but I'm

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.