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  

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 I print \n in C or C++ programming?
void main () { printf(" "); getch(); }
Supriyo
0 0
6
How can I develop my C language?
https://vz-3ad30922-ba4.b-cdn.net/c616c4df-8596-4ae7-bb61-c6f1d87e5e4d/play_480p.mp4
Mohit
0 0
5
Can an array be an lvalue?
The answer to this question is no, because an array is composed of several separate array elements that cannot be treated as a whole for assignment purposes. The following statement is therefore illegal:...
Vinodha
What are the toughest topics in C language?
Pointers and memory management
Kavidassan
0 0
6
How do you override a defined macro?
We can use the #ifdef and #undef directive to undefine a previously defined macro.
Sharmistha

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

Ask a Question

Related Lessons

Recursion in C Programming
The process of calling a function by itself is called recursion and the function which calls itself is called recursive function. Syntax of Recursive Function returntype recursive_func () { statements; ...
R

Ravindra Yadav

2 0
0

10 Tips to improve your learning
1. Have a quick revision of topics that you have read in past three days before you start studying a new topic. 2. Make your own notes containing the summary of the topic. 3. Allot proper timing for...

Lets know about far, near and huge pointers for fresher interview purpose
All of these three candidates relate to 16 bit architecture where segmented memory architecture was there. They are not at all relevant for present days 32 or 64 bit architecture where the way of memory...

Efficient Learning Strategies
Type your notes after class Write your notes onto flashcards - Scrabble -Make posters Review flashcards while walking, at gym, etc. Dog-ear pages in the reading where you can find...

Functions In C Programming
A C-language program is nothing but collection of Function, these are the building blocks of a ‘C’ program. Generally, a function mans a task. “Function is a...

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 >

Hadoop is a framework which has been developed for organizing and analysing big chunks of data for a business. Suppose you have a file larger than your system’s storage capacity and you can’t store it. Hadoop helps in storing bigger files than what could be stored on one particular server. You can therefore store very,...

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