c++ - Array Equivalent of Bare-String -


i can without issue:

const char* foo = "this bare-string"; 

what want able same thing array:

const int* bar = {1, 2, 3}; 

obviously code doesn't compile, there kind of array equivalent bare-string?

you can't this:

const int* bar = {1, 2, 3}; 

but can this:

const int bar[] = {1, 2, 3}; 

reason char* in c (or c++) have added functionality, besides working char pointer, works "c string", added initialization method (special char*):

const char* foo = "this bare-string"; 

best.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -