In this post, we will teach you what is #define in c and how it is work. #define in c is a very simple topic so we telling this topic.
To understand this program, you must have this knowledge:
what is #define in c?
a macro is an identifier defined in a #define preprocessor directive.
the #define directive defines an identifier and a character sequence a set of characters that will be substituted for the identifier each time it is encountered in the source file.
the identifier is referred to as a macro name and the replacement process as macro replacement.
as with symbolic constants, the macro identifier is replaced in the program with the replacement text before the program is compiled.
macros may be defined with or without arguments.
a macro without arguments is processed like a symbolic constant.
In a macro with arguments, the arguments are substituted in the replacement text, then the macro is expanded.
source code: program simple Interest with #define in c
Output Screen
Enter pri, rate, time : 5000 10 1 Intrest : 500.0000 Your simple Intrest is : 5500.0000
Program Logic
We will include #define
as a header file.
We just have to write #define
. Then the name of the macro and the character-sequences.
We just have to take input from the user. whose macro we created. Have to pass the value in it. The macro will calculate and give the result.
Recommended Post
- Number searching program through enum in c
- c program for multiplication of two matrices
- c program fibonacci series using recursion
- coprime number program
- c program swap two numbers using pointers
😊
Now next you are, write your code in the comment below.😊
0 Comments:
Post a Comment
Please do not enter any spam link in the comment box.