+ 1

Infix to postfix in c

While writing program for infix to postfix in why we use #define max 50, instead of int max=50

28th Oct 2018, 3:25 PM
harshit
harshit - avatar
1 Antwort
0
Code manutence. Like with you have a program that defines a x size to read a input but the book is y size and y > x. So you will need tp change and is more easier change the value one time than change multiple values or single but in middle of code. Here a code of mine: https://code.sololearn.com/cG7ieJFrOa2J/?ref=app In this code i needed to test buffer size multiple times. And it was easy because i used #define for this. Edit: you can use #define for making a macro or define a constant that no will change like PI. In mine code case it was for represent the limit (max and min)
28th Oct 2018, 3:41 PM
Anya
Anya - avatar