anonymous array in method argument

Reply

Join Date: Jul 2008
Posts: 1
Reputation: joopdirksen is an unknown quantity at this point 
Solved Threads: 0
joopdirksen joopdirksen is offline Offline
Newbie Poster

anonymous array in method argument

 
0
  #1
Jul 17th, 2008
Hello, i'm relatively new to C++, and i'm wondering, how can i pass in an anonymous array into a method?

  1.  
  2. float color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
  3. 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:

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

Is this possible? Thanks.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,160
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1437
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Most Valuable Poster

Re: anonymous array in method argument

 
0
  #2
Jul 17th, 2008
>>Is this possible? Thanks.
Yes -- do it the way you posted in the first code snippet.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC