So I am new to programming and even newer to Xcode. I am having trouble using a struct in Xcode. I have gotten to the point where I copied and pasted the code,
struct product {
int weight;
float price;
} ;
product apple;
from the c++ site, but when I try to declare the apple’s weight via apple.weight = 5;
I get errors saying unknown type name ‘apple’ and expected unqualified Id at .
Simple: You have a structure, not a
typedefstructure.You can use it as follows:
However, if you use a typedef, you can give your datatype an actual name: