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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:40:39+00:00 2026-06-13T10:40:39+00:00

class Foo {}; int main() { Foo *foo[500] = { NULL}; } Regardless of

  • 0
class Foo {};

int main()
{
   Foo *foo[500] = { NULL}; 
}

Regardless of O.S/compiler is it standard that the whole array will be set to NULL?

  • 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-13T10:40:40+00:00Added an answer on June 13, 2026 at 10:40 am

    Yes it is valid and guaranteed by the C++ Standard.

    Reference:

    C++03 Standard 8.5.1 Aggregates
    Para 7:

    If there are fewer initializers in the list than there are members in the aggregate, then each member not explicitly initialized shall be value-initialized (8.5).
    [Example:

     struct S { int a; char* b; int c; };
     S ss = { 1, "asdf" };
    

    initializes ss.a with 1, ss.b with "asdf", and ss.c with the value of an expression of the form int(), that is,0. ]

    Value Initialization is defined under:

    C++03 8.5 Initializers
    Para 5:

    To value-initialize an object of type T means:
    — if T is a class type (clause 9) with a user-declared constructor (12.1), then the default constructor for T is called (and the initialization is ill-formed if T has no accessible
    default constructor);
    — if T is a non-union class type without a user-declared constructor, then every non-static
    data member and base-class component of T is value-initialized;
    — if T is an array type, then each element is value-initialized;
    — otherwise, the object is zero-initialized

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

Sidebar

Related Questions

class Foo { public int A { get; set; } } class Program {
My class: public class Foo { public int A { get; set; } public
class Foo { public: Foo() { Foo(1)} Foo(int x, int y = 0):i(x) {}
if i have class foo { int a int b } and a List<foo>
I have: class Foo { int a; int b; std::string s; char d; };
I have a class class foo { public: foo(); foo( int ); private: static
I have a method in a class as follows... class foo{ int bar::randomNum10to50(){ srand
Foo.java public class Foo{ public int i = 0; } Bar.scala class Bar() extends
Suppose you have a simple class like this: class foo{ private: int* mData; int
class Foo { public: void bar(); }; void Foo::bar() { static int n =

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.