Developer community
0 votes
86 views
asked by Geek (15.3k points) 18 43 68 | 86 views

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 by Guru (39.1k points) 10 22 37

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

Categories


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

3.8k questions

4k answers

117 comments

10.7k users

3,754 questions
4,046 answers
117 comments
10,709 users