UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What is a macro, and how do you use it?

Asked by Last Modified  

3 Answers

Learn C Language

Follow 0
Answer

Please enter your answer

Tutor of C, Core Java, having 5 years of development experience in DRDO, Bangalore and Honeywell

Macro is used where we want to use a value many times in a code. Also there is a possibility that the in future, the value would change. Then changing the value all over the code does not make any sense. There has to be a way out through which one can make the change at one place and it would get reflected...
read more
Macro is used where we want to use a value many times in a code. Also there is a possibility that the in future, the value would change. Then changing the value all over the code does not make any sense. There has to be a way out through which one can make the change at one place and it would get reflected at all the places read less
Comments

Programming Language Tutor

Macro refers to a #define definition that is used to define words to enhance readability and understandability of the program.It defines an identifier and string or constant that is substituted for the identifier each time it is encountered in the program.This identifier is called a macro and the replacement...
read more
Macro refers to a #define definition that is used to define words to enhance readability and understandability of the program.It defines an identifier and string or constant that is substituted for the identifier each time it is encountered in the program.This identifier is called a macro and the replacement procedure is termed macros substitution. example :- #define m 10 void main(){ int b,c; b=m+1; c=b*m; printf("%d\t%d",b,c); } In the above program, we consider two statement 1. b=m+1 in this the value of m is substituted to 2 and then add 1 so result is 3 which is assigned to b, 2. c=b*m we have obtained the value of b is 3 and the value of variable m is substitute to 2, hence result is 6, assigned to c. read less
Comments

Engineer by profression, Tutor by passion

A macro is a name given to a "block of the code" which can be substituted where the code snippet is to be used for more than once. Different ways of using macros are as follows: 1) Defining Macros without values eg- #define MACRO1. In this case we use them as testing conditions along with ifdef statements. 2)...
read more
A macro is a name given to a "block of the code" which can be substituted where the code snippet is to be used for more than once. Different ways of using macros are as follows: 1) Defining Macros without values eg- #define MACRO1. In this case we use them as testing conditions along with ifdef statements. 2) Macros with values,eg - #define MACRO1 25. In the preprocessing stage of the compilation process, the name of this macro is replaced with macros value all over the code. 3) Macros with piece of code as their values, eg - #define MACRO(i) (i*78) * (45+x) read less
Comments

View 1 more Answers

Related Questions

How do you override a defined macro?
We can use the #ifdef and #undef directive to undefine a previously defined macro.
Sharmistha
What is the best website to learn c language?
First go through the book "Let Us C" by Yashawant Kanetkar, then try to implement few small codes by your own, it takes time but you will learn it properly by experience only
Nom
Is a default case necessary in a switch statement?
NO, default is optional and you can omit it if there is no use of it.
My
Is it necessary to mention the header files in the C programming language?
yaa !!!!! it is necessary because we need the data present in evey header file...like example we can do mathematical calculations with the help of math header file.
Hari
Why are there so many programming languages if most programmers use C, C++, Java, and PHP?
This question has the same answer as the question"Why there are so many languages?" has... As they were ask meant for different purpose to serve for different platforms... For short: Link it to the languages used
Veerendra
0 0
7

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Recommended Articles

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more