Click here to Skip to main content
15,904,287 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: two dimensional array initialization Pin
George_George27-Jul-07 0:19
George_George27-Jul-07 0:19 
GeneralRe: two dimensional array initialization Pin
Michael Dunn27-Jul-07 10:08
sitebuilderMichael Dunn27-Jul-07 10:08 
GeneralRe: two dimensional array initialization Pin
George_George27-Jul-07 20:10
George_George27-Jul-07 20:10 
GeneralRe: two dimensional array initialization Pin
Michael Dunn28-Jul-07 9:40
sitebuilderMichael Dunn28-Jul-07 9:40 
GeneralRe: two dimensional array initialization Pin
George_George28-Jul-07 19:36
George_George28-Jul-07 19:36 
AnswerRe: two dimensional array initialization Pin
Michael Dunn27-Jul-07 10:07
sitebuilderMichael Dunn27-Jul-07 10:07 
GeneralRe: two dimensional array initialization Pin
George_George27-Jul-07 20:07
George_George27-Jul-07 20:07 
GeneralRe: two dimensional array initialization Pin
Michael Dunn28-Jul-07 9:56
sitebuilderMichael Dunn28-Jul-07 9:56 
char s1[4] = "cat";
char s2[] = "dog";
In both of those cases, the array size is 4. The compiler can deduce the size of s2 from the initializer string, which is 4 chars long.
char* s3[2] = { "hello", "bob" };
char* s4[] = { "code", "project" };
Here, the arrays contain char*. Again, the compiler can deduce the size of s4 because the initializer has two char*s.
Now make it a 2-D array (I'll switch to ints since the initializer syntax is more precise)
int i5[5][2] = { {1,2,3,4,5}, {6,7,8,9,10} };
i5 is an array of two int[5] arrays. Now if I did this:
int i6[5][] = { {1,2,3,4,5}, {6,7,8,9,10}, {0,2,4,6,8} };
Since I used three int[5] arrays in the initializer, the compiler deduces that i6 is int[5][3]. (BTW I just realized that my earlier post was wrong, it's the last dimension that you can leave out, not the first.)


--Mike--
Visual C++ MVP Cool | :cool:
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

Dunder-Mifflin, this is Pam.

GeneralRe: two dimensional array initialization Pin
George_George28-Jul-07 19:40
George_George28-Jul-07 19:40 
Question(Beginner) string as an argument in file.open() ? Pin
garfaoui26-Jul-07 23:21
garfaoui26-Jul-07 23:21 
AnswerRe: (Beginner) string as an argument in file.open() ? Pin
ThatsAlok26-Jul-07 23:32
ThatsAlok26-Jul-07 23:32 
QuestionRe: (Beginner) string as an argument in file.open() ? Pin
garfaoui26-Jul-07 23:39
garfaoui26-Jul-07 23:39 
AnswerRe: (Beginner) string as an argument in file.open() ? Pin
toxcct26-Jul-07 23:47
toxcct26-Jul-07 23:47 
GeneralRe: (Beginner) string as an argument in file.open() ? Pin
garfaoui26-Jul-07 23:50
garfaoui26-Jul-07 23:50 
AnswerRe: (Beginner) string as an argument in file.open() ? Pin
Rage26-Jul-07 23:55
professionalRage26-Jul-07 23:55 
AnswerRe: (Beginner) string as an argument in file.open() ? Pin
garfaoui27-Jul-07 0:00
garfaoui27-Jul-07 0:00 
Questionread stl files Pin
saisp26-Jul-07 22:51
saisp26-Jul-07 22:51 
AnswerRe: read stl files Pin
CPallini26-Jul-07 23:14
mveCPallini26-Jul-07 23:14 
GeneralRe: read stl files Pin
beko26-Jul-07 23:28
beko26-Jul-07 23:28 
GeneralRe: read stl files Pin
saisp26-Jul-07 23:42
saisp26-Jul-07 23:42 
GeneralRe: read stl files Pin
beko27-Jul-07 4:17
beko27-Jul-07 4:17 
GeneralRe: read stl files Pin
CPallini26-Jul-07 23:42
mveCPallini26-Jul-07 23:42 
GeneralRe: read stl files Pin
saisp26-Jul-07 23:49
saisp26-Jul-07 23:49 
QuestionView Style Changes when switching the compiler option _UNICODE to _MBCS [modified] Pin
F.Falk26-Jul-07 22:42
F.Falk26-Jul-07 22:42 
AnswerRe: View Style Changes when switching the compiler option _UNICODE to _MBCS Pin
Mark Salsbery27-Jul-07 6:24
Mark Salsbery27-Jul-07 6:24 

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.