I need to make a struct that contains a long for student id. In my case, my student id is 0xxxxxxx
my code looks like this:
Code:
struct student {
char *name;
int age;
long int id;
float gpa;};
int main(int argc, char *argv[])
{
struct student student1 = {"name",xx,0xxxxxxx,x.x};
printf("%s\n",student1.name);
printf("%i\n",student1.age);
printf("%i\n",student1.id);
printf("%.1f\n",student1.gpa);
}
When I try to compile it, I get an octal constant error, which, or course, I don't want. So is there any way I can get this to work?
Also, a less important question. My full id actually starts "A", but since the teacher wants me to use long, it can't be helped, right?
Oh, and I am very new to C, so I'm aware that my code is probably horribly inefficient. Any tips would be appreciated. Thanks.