Click here to Skip to main content
15,905,322 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Array Variable initialization Pin
toxcct9-Sep-08 2:32
toxcct9-Sep-08 2:32 
GeneralRe: Array Variable initialization Pin
T.RATHA KRISHNAN9-Sep-08 2:39
T.RATHA KRISHNAN9-Sep-08 2:39 
GeneralRe: Array Variable initialization Pin
toxcct9-Sep-08 2:42
toxcct9-Sep-08 2:42 
GeneralRe: Array Variable initialization Pin
T.RATHA KRISHNAN9-Sep-08 2:51
T.RATHA KRISHNAN9-Sep-08 2:51 
GeneralRe: Array Variable initialization Pin
toxcct9-Sep-08 2:59
toxcct9-Sep-08 2:59 
QuestionRe: Array Variable initialization Pin
CPallini9-Sep-08 3:34
mveCPallini9-Sep-08 3:34 
AnswerRe: Array Variable initialization Pin
toxcct9-Sep-08 3:37
toxcct9-Sep-08 3:37 
GeneralRe: Array Variable initialization [modified] Pin
CPallini9-Sep-08 5:13
mveCPallini9-Sep-08 5:13 
toxcct wrote:
you are, or the compiler is !


Maybe the latter:
the program:
#include <iostream>
using namespace std;

void main()
{
  const int N = 10;
  int a[N]={7};

  for (int i=0; i<N;i++)
  {
    cout << a[i] << endl;
  }
}


the output:
7
0
0
0
0
0
0
0
0
0

The system:
Visual C++ 2008 Express Edition running on Win XP.

Eventually YOU may be wrong! Poke tongue | ;-P (actually I'm quite confident you're right, but don't use it unless you really want surprises!)

[added]
Actually I think VS2008 cannot be so out-of-the-standard.
I suppose the standard establishing that, whenever the initialization list is too short, the remaining array
items are default-initialized (to 0 if integers).
[/added]

Smile | :)

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke

[My articles]

modified on Tuesday, September 9, 2008 11:53 AM

GeneralRe: Array Variable initialization Pin
SandipG 9-Sep-08 5:19
SandipG 9-Sep-08 5:19 
GeneralRe: Array Variable initialization Pin
toxcct9-Sep-08 5:40
toxcct9-Sep-08 5:40 
GeneralRe: Array Variable initialization Pin
CPallini9-Sep-08 6:10
mveCPallini9-Sep-08 6:10 
GeneralRe: Array Variable initialization Pin
toxcct9-Sep-08 6:12
toxcct9-Sep-08 6:12 
AnswerRe: Array Variable initialization Pin
David Crow9-Sep-08 4:35
David Crow9-Sep-08 4:35 
GeneralRe: Array Variable initialization Pin
CPallini9-Sep-08 5:18
mveCPallini9-Sep-08 5:18 
GeneralRe: Array Variable initialization Pin
David Crow9-Sep-08 5:21
David Crow9-Sep-08 5:21 
GeneralRe: Array Variable initialization Pin
CPallini9-Sep-08 5:30
mveCPallini9-Sep-08 5:30 
GeneralRe: Array Variable initialization Pin
toxcct9-Sep-08 5:42
toxcct9-Sep-08 5:42 
GeneralRe: Array Variable initialization Pin
CPallini9-Sep-08 6:01
mveCPallini9-Sep-08 6:01 
GeneralRe: Array Variable initialization Pin
David Crow9-Sep-08 6:04
David Crow9-Sep-08 6:04 
GeneralRe: Array Variable initialization Pin
CPallini9-Sep-08 9:26
mveCPallini9-Sep-08 9:26 
GeneralRe: Array Variable initialization Pin
David Crow9-Sep-08 10:16
David Crow9-Sep-08 10:16 
GeneralRe: Array Variable initialization Pin
CPallini9-Sep-08 10:24
mveCPallini9-Sep-08 10:24 
AnswerRe: Array Variable initialization Pin
laksh22049-Sep-08 2:48
laksh22049-Sep-08 2:48 
GeneralRe: Array Variable initialization Pin
T.RATHA KRISHNAN9-Sep-08 2:56
T.RATHA KRISHNAN9-Sep-08 2:56 
Questionhelp on using asynchronous sockets in windows using multiple threads Pin
mohant$.net9-Sep-08 2:26
mohant$.net9-Sep-08 2:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.