objective c - "initializer element is not a compile-time constant" when assigning results of basic math operation in Xcode -
int x = 10; float y= 3.5; float z =x*y;
i enter error xcode doesn't recognize * , says "initializer element not compile-time constant" what's happening? (i complete beginner btw.)
the problem you're declaring these @ file scope. global variables have initialised @ compile time, not runtime, , aren't allowed initialise them other variables.
if declare these in function there no problem. if you're using constants anyway, can initialise z
directly 35.0.
Comments
Post a Comment