#include <stdio.h>
#define Pass 1
#define Fail 0
#define A 4
#define B 5
#define C 6
struct student {
// The bit fields member variables are result and grade, the *name is of character type
char* name;
unsigned result: 1;
unsigned grade : 4;
};
int main(){
struct student newStudent = { "Mary", Pass, B};
printf("Name: %s\n", newStudent.name);
printf("Result: %d\n", newStudent.result);
printf("Grade: %d\n", newStudent.grade);
getchar();
getchar();
return 0;
}
Comments
Leave a comment