Objective C -- passing array literal to a method

Posted by morgancodes on Stack Overflow See other posts from Stack Overflow or by morgancodes
Published on 2010-03-23T15:37:54Z Indexed on 2010/03/23 15:53 UTC
Read the original article Hit count: 329

Filed under:

This seems to work (compiler doesn't complain, anyway):

float adsr[4] = {0,1.0/PULSE_SPEED, 0,1};
[sequence setBaseADSR:adsr];

but I want to make it more concise and do this:

[sequence setBaseADSR:{0,1.0/PULSE_SPEED, 0,1}];

How do I do it? In javascript, I'd call stuff in the brackets an "array literal". Not sure if C languages have the same concept or terminology though.

© Stack Overflow or respective owner

Related posts about objective-c