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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:15:09+00:00 2026-05-25T01:15:09+00:00

In my C++ program I am trying to initialize a 3*3*3 array of type

  • 0

In my C++ program I am trying to initialize a 3*3*3 array of type double with all 0’s.
In the class header file, I declared a member

double list[3][3][3];

When I printed out the content of this array, I found that not all entries are 0 as I expected. e.g. list[1][1][1] has value 4.03158e-321

Hence I manually initialized this array to all 0’s in the constructor:

list = {{{0,0,0},{0,0,0},{0,0,0}},
      {{0,0,0},{0,0,0},{0,0,0}},
      {{0,0,0},{0,0,0},{0,0,0}}};

This makes my program work, however, I got the compiler warning:

warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x

My question is therefore

  1. Why does list have non-zero entries after being initialized in the
    header?
  2. Why do I get the above warning message, and how to get rid of it?

My compiler is g++ (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2, with gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)

  • 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-25T01:15:09+00:00Added an answer on May 25, 2026 at 1:15 am

    Am I missing something or can you not just do

    class Class {
    public:
        double array[3][3][3];
    
        Class() : array() { }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a simple program in VC++ which will just initialize the
Imagine we have a program trying to write to a particular file, but failing.
I am trying to loop through an integer array using C# Iterators. The program
Okay so I'm trying to make a file browser program, and I'm in the
I am trying out ruby by making a program i need. I have a
I'm trying to achieve a dynamic two dimensional array in C. Whenever the program
I have a simple OpenGL program and trying to draw an instanced array that
Stuck here trying to initialize an array (c#) using a loop. The number of
My program is trying to create an key on the HKLM\Software\Microsoft\Shared Tools\MSCONFIG\startupreg\test\ but instead
Some overflow runtime error happens when my C++ program is trying to write some

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.