Empty list matrix initialization "{ }" in C++

Asked

Viewed 2,466 times

2

From what I have seen, it is possible to initialize a vector with the empty list, in C++, but not in C, so that all vector elements are 0:

int meuVetor[10] = {}; // Todos os elementos 0, em C++

What I’ve learned in that reply soen.

It is possible, however, to initialize a matrix in this way?

int minhaMatriz[10][10] = {};

All its elements would be 0?

All I tested was segmentation failure, but I can’t tell if it was related.

1 answer

3


  • Mine worked: https://ideone.com/BLv169. Yours doesn’t seem to do otherwise.

  • 1

    It’s a memory overflow problem, shrinking gets right.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.