Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
4.0k views
in Computer by (69.7k points)

Define a macro. Write a nested macro that gives the minimum of three values.

1 Answer

+1 vote
by (69.2k points)
selected by
 
Best answer

Macro is a preprocessor directive, also known as macro definition takes the following general form:

#define identifier string

The pre-processor directive replaces every occurrence of the identifier in the source code by the string. The preprocessor directive definition is not terminated by a semicolon. For example 

#define COUNT 100 will replace all occurrences of COUNT with 100 in the whole program before compilation.

A nested macro that gives minimum of three values is listed below:

#define minthree(a,b,c) (min(min(a,b),c))

void main() 

int x,y,z,w; 

clrscr(); printf("enter three numbers :\n"); 

scanf("%d%d%d",&x,&y,&w);

z=minthree(x,y,w); 

printf("Minimum of three value is %d",z); 

getch(); 

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...