#import <Foundation/Foundation.h>
struct {
double x;
float yellow;
double number;
}budget;
struct budget random; //error: redefinition of random
void color(dollar){
random.number = random.x - dollar; //error member referance has a base type long(void)not a structure or union.
}
int main(int argc, const char * argv[]){
random.x = 10;//error member referance has a base type long(void)not a structure or union.
random.yellow = 1.4;//error member referance has a base type long(void)not a structure orunion
int dollar = 4;
color(newNumber); use of undeclared variable new number.
NSLog(@"the total budget is %.2f", random.number); //error member referance has a base type long(void)not a structure or union.
return 0 ;
}
我正在关注关于 Objective-C 的视频教程:http ://www.youtube.com/watch?v=RsXivZEU9rc&list=SP54515103C712A53D&index=19 ,我已经尝试了我能想到的一切,但这段代码不会返回random.number
总数,这将random.x-dollar
如函数中所述color()
。然后我调用color()
并重main
命名了它的参数,它应该复制dollar
到函数中并返回它,但事实并非如此。这是怎么回事?