What is the benefit of using #define to declare a constant?



What is the benefit of using #define to declare a constant?..

Answer / Shamee Ahmad

Using #define in C allows you to create constants that can be used throughout your code. This can increase readability, make your code more maintainable, and potentially reduce compile times because the preprocessor replaces the define with its value before compiling.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

In the following control structure which is faster? 1.Switch 2.If-else and which consumes more memory?

4 Answers  


main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }

1 Answers   Wilco,


When do we get logical errors?

1 Answers  


what is the diff between the printf and sprintf functions?? and what is the syntax for this two functions ??

5 Answers  


Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it?

3 Answers  


If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402

1 Answers  


The differences between Windows XP and Windows Visa

8 Answers   HCL,


What is the need of structure in c?

1 Answers  


a=5 a=a++/++a

14 Answers   Bhel,


why effort estimation is important?

1 Answers  


#include<stdio.h> int main(){ int i=10; int *ptr=&i; *ptr=(int *)20; printf("%d",i); return 0; } Output: 20 can anyone explain how came the output is 20

1 Answers  


What are the disadvantages of external storage class?

1 Answers  


Categories