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 1
Answer

Please enter your answer

Professional Tutor with 15 years of experience.

A macro is a fragment of code which has been given a name. Whenever the name is used, it is replaced by the contents of the macro. There are two kinds of macros. They differ mostly in what they look like when they are used. Object-like macros resemble data objects when used, function-like macros resemble...
read more
A macro is a fragment of code which has been given a name. Whenever the name is used, it is replaced by the contents of the macro. There are two kinds of macros. They differ mostly in what they look like when they are used. Object-like macros resemble data objects when used, function-like macros resemble function calls. read less
Comments

Macro is a preprocessor directive we can give any name to any thing it doesn't give any errors compailer replace that names preprocessor stage only
Comments

website and mobile application development training, digital marketing training

A macro is a name given to a block of C statements as a preprocessor directive. Being a pre-processor, the block of code is communicated to the compiler before entering into the actual coding (main () function). A macro is defined with the preprocessor directive, #define.
Comments

Macros are generally used to define constant values that are being used repeatedly in program. Macros can even accept arguments and such macros are known as function-like macros. It can be useful if tokens are concatenated into code to simplify some complex declarations. Macros provide text replacement...
read more
Macros are generally used to define constant values that are being used repeatedly in program. Macros can even accept arguments and such macros are known as function-like macros. It can be useful if tokens are concatenated into code to simplify some complex declarations. Macros provide text replacement functionality at pre-processing time. Here is an example of a simple macro : #define MAX_SIZE 10 The above macro (MAX_SIZE) has a value of 10. Here is a simple program #include #define MAX_SIZE 10 int main(void) { int size = 0; size = size + MAX_SIZE; printf("%d",size); return 0; } read less
Comments

Professional Trainer:: Hadoop Big Data, DevOps, Perl, Python

macro is single line code block, e.g. #define area(r) (3.1415*(r)*(r)) where ever you refer to the macro area(r), it will be replace with the actual code block defined in macro radius=10; area=area(radius); so in the above code the macro is replaced with the actual code area=(3.1415*(radi...
read more
macro is single line code block, e.g. #define area(r) (3.1415*(r)*(r)) where ever you refer to the macro area(r), it will be replace with the actual code block defined in macro radius=10; area=area(radius); so in the above code the macro is replaced with the actual code area=(3.1415*(radius)*(radius)) read less
Comments

Tutor of programming language and tutor of I-V and VI-VII

A macro is a name given to a block of C statements as a pre-processor directive. Being a pre-processor, the block of code is communicated to the compiler before entering into the actual coding (main () function). A macro is defined with the preprocessor directive, #define. Before compilation, the name...
read more
A macro is a name given to a block of C statements as a pre-processor directive. Being a pre-processor, the block of code is communicated to the compiler before entering into the actual coding (main () function). A macro is defined with the preprocessor directive, #define. Before compilation, the name of macro is replaced by the defined macro body. The speed of the execution of the program is the major advantage of using a macro. Disadvantage: The size of the program is large. Example: #include"stdio.h" #define X 100 void main() { printf("%d",X); } read less
Comments

International Corporate Trainer For dotnet Core ,Angular 2 ,C ,C++ and LPT Marathi for RBI Banking

Macro in C is also called symbolic constant , it replaces the code part. ex:#define line "\n..................\n", ex: #define Square(x) (x)*(x), this is called function macro it will work as Square(5) = 25 but it is not type safe user may enter alphabet instead of number and progam will fail. better...
read more
Macro in C is also called symbolic constant , it replaces the code part. ex:#define line "\n..................\n", ex: #define Square(x) (x)*(x), this is called function macro it will work as Square(5) = 25 but it is not type safe user may enter alphabet instead of number and progam will fail. better way is to use user defined function read less
Comments

printf ("File Name = %s.\n",__FILE__);
Comments

Oracle, Hindi, C++, C, MS Office, VBScript,JavaScript,Spoken English etc with 29 years of experience

Macros automate frequently-used tasks; many are created with VBA and are written by software developers. However, some macros pose a potential security risk.
Comments

IT Professional Trainer with 13 years of experience in IT industry + Academics

It is preprocessor directive which is being included prior to compilation process of a program.
Comments

View 14 more Answers

Related Questions

What are security issues in the C language?
Even though the C language is widely used in different systems still it has many security flaws associated with it. This article focuses on discussing security vulnerabilities in the C language. Mainly...
Avinesh
0 0
7
How do I get 6 power 13 in c language?
By using pow() function #include <math.h>#include <stdio.h>int main() { double base = 6.0; double exp = 13.0; double result = pow(base, exp); printf("%.1lf^%.1lf = %.2lf", base, exp, result); return 0;}
Tanush
0 0
5
Give the structure of 'C' programming. Also, give significance of math.h and string.h header files.
Hi, C structure is procedural programming. math.h and string .h will have a declerations of predefined methods. math.h ex: sqrt(),...etc. string.h ex: strlen(),strcpy,...etc. if you wanna brif let meknow. Thanks.
Ishwari
Can we pass arguments in the main function in C language?
Yes. it is possible to pass arguments into the main function.
Mukesh
0 0
7
Is C language the base for learning C++?
No. C and C++ are two different languages. All most all modern languages are influenced by C language. But we can learn C++ directly without learning C language.
Swathi
0 0
8

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

Ask a Question

Related Lessons

Program to swap the value of two variables without using third variable(simplest way)...
int main() { int a=10,b=20; printf("values of a before swap ="%d,a); printf("values of b before swap ="%d,b); a=a+b; b=a-b; a=a-b; printf("******************"); printf("values of a after swap...

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

How to write shared library program using C Programming?
Library Name : hellofilename : hello.c#include void Hello(){ printf("Hello World .. How are you 1\n");}======================================Header File:hello.h#ifndef __HELLO_H#define __HELLO_Hvoid Hello(void);#endif===============================Application...


C Program Sample Application
//Standard Library Functions(Header Files used) #include<stdio.h> #include <conio.h> //Main method int main() { // function for clearing screen clrscr(); // function to print the output...
S

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 >

Whether it was the Internet Era of 90s or the Big Data Era of today, Information Technology (IT) has given birth to several lucrative career options for many. Though there will not be a “significant" increase in demand for IT professionals in 2014 as compared to 2013, a “steady” demand for IT professionals is rest assured...

Read full article >

Business Process outsourcing (BPO) services can be considered as a kind of outsourcing which involves subletting of specific functions associated with any business to a third party service provider. BPO is usually administered as a cost-saving procedure for functions which an organization needs but does not rely upon to...

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