#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
总数,这将是{{1如函数random.x-dollar
中所述。然后我在color()
中调用了color()
并重命名了它的参数,该参数应该在函数中复制main
并返回它,但事实并非如此。发生了什么事?
答案 0 :(得分:2)
由于工作原因,我无法观看视频,但您正在重新定义“随机”。尝试用另一个名称替换变量“random”。其余的错误只是从第一个错误级联(你重新定义随机)。