What's the best way to declare and define global variables?
Answers were Sorted based on User's Feedback
Answer / guest
The best arrangement is to place each definition in some
relevant .c file, with an external declaration in a header file.
| Is This Answer Correct ? | 17 Yes | 3 No |
Answer / karnik ankit
the best way to declare and define global variables after
the header files or before the main function.
| Is This Answer Correct ? | 11 Yes | 1 No |
Answer / anurag aggarwal
after declaring the header files declare the global
variables to be used that is the best way.
| Is This Answer Correct ? | 8 Yes | 1 No |
Answer / vignesh1988i
as for C is concerned the best way to declare and define the
global variable is brefore the main() function
| Is This Answer Correct ? | 10 Yes | 5 No |
Answer / ajeet singh
through the "public" key world, we define the globle variable.
| Is This Answer Correct ? | 1 Yes | 5 No |
Why calloc is better than malloc?
List some basic data types in c?
What is the difference between functions getch() and getche()?
What is a MAC Address?
write a program to generate address labels using structures?
Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?
What is a wrapper function in c?
Between macros and functions,which is better to use and why?
Write a program to swap two numbers without using third variable?
What should be keep precautions while using the recursion method?
What is dynamic dispatch in c++?
Is the below things valid & where it will be stored in memory layout ? static const volatile int i; register struct { } ; static register;