#include <stdio.h>
typedef struct{
unsigned int _1_:7;
unsigned int _2_:7;
unsigned int _3_:7;
unsigned int _4_:7;
unsigned int _5_:7;
} grades;
// ---other part of code---
grades student;
int main(){
scanf("%u\n", student._1_)
// all the others...
return 0;
}
I don't know the way to do it. I tried to put &
in front of
student._1_
but it didn't work. If someone could show me how to
do it, not only with bitfields but also with normal structs and enums.