DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C++ (http://www.daniweb.com/forums/forum8.html)
-   -   anonymous array in method argument (http://www.daniweb.com/forums/thread135116.html)

joopdirksen Jul 17th, 2008 8:57 pm
anonymous array in method argument
 
Hello, i'm relatively new to C++, and i'm wondering, how can i pass in an anonymous array into a method?


float color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
showInfo("test", 10, 10, color, GLUT_BITMAP_HELVETICA_12);

I want to put the float array color into the argument itself, so i don't have to specify it separately, something like this:


showInfo("test", 10, 10, {1.0f, 1.0f, 1.0f, 1.0f}, GLUT_BITMAP_HELVETICA_12);

Is this possible? Thanks.

Ancient Dragon Jul 17th, 2008 9:43 pm
Re: anonymous array in method argument
 
>>Is this possible? Thanks.
Yes -- do it the way you posted in the first code snippet.


All times are GMT -4. The time now is 2:07 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC