search
Login

Categories


C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers

117 comments

10.7k users

0 votes
75 views
asked Geek 15.3k points 16 41 63

1 Answer

0 votes

 

#include<stdio.h>

#include<conio.h>

#define PETROL 1

#define DISEL 2

#define TWO_WH 3

#define FOUR_WH 4

#define OLD 5

#define NEW 6

void main()

{

struct vehicle

{

unsigned type:3;

unsigned fuel:2;

unsigned model:3;

};

struct vehicle v;

v.type=FOUR_WH;

v.fuel=DISEL;

v.model=OLD;

clrscr();

printf(“\n Type of vehicle: %d”,v.type);

printf(“\n Fuel: %d”,v.fuel);

printf(“\n Model: %d”,v.model);

getch();

}

Output:

Type of Vehicle : 4

Fuel : 2

Model : 5 

answered Guru 39.1k points 10 21 33

...