Question
What is the purpose of the #define directive in
programming languages like C and C++?Solution
The #define directive in C and C++ is a preprocessor command used to define macros. Macros can be constants or code snippets that are substituted into the program wherever they are referenced. For example, #define PI 3.14 defines a constant named PI with the value 3.14 . Similarly, #define SQUARE(x) ((x) * (x)) defines a macro for computing the square of a number. This directive helps in making the code more readable, manageable, and easier to maintain by avoiding the repetition of constants and code fragments. It operates at the preprocessing stage before the actual compilation of the code begins.
What was highlighted as India’s current clean energy capacity within its 500 GW power grid during the India–Canada Ministerial Dialogue?Â
- What is the title of the book released by MeitY promoting circular economy innovation?
- How many crore MUDRA loans have been disbursed in 10 years since launch?
Sarwagya Singh Kushwaha achieved what FIDE rating to become the world’s youngest rated chess player?Â
Which countries signed a defence pact allowing joint military drills?
What does 'UNDP' stand for?
Which initiative by the government aims to promote chemical-free farming practices in India?
What is the primary focus of the "Baltic Sentry" mission launched by NATO?
Who won India’s first gold at the 2025 ISSF Junior World Cup in Germany?
Which state has become the first state to adopt a water budget in a bid to come up with a solution to water scarcity in certain regions there?