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.

>>Is this possible? Thanks.
Yes -- do it the way you posted in the first code snippet.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.