What's the best way to declare and define global variables?

Answers were Sorted based on User's Feedback



What's the best way to declare and define global variables?..

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

What's the best way to declare and define global variables?..

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

What's the best way to declare and define global variables?..

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

What's the best way to declare and define global variables?..

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

What's the best way to declare and define global variables?..

Answer / sathish

before the main

Is This Answer Correct ?    1 Yes 2 No

What's the best way to declare and define global variables?..

Answer / ajeet singh

through the "public" key world, we define the globle variable.

Is This Answer Correct ?    1 Yes 5 No

What's the best way to declare and define global variables?..

Answer / s.madhavi

By using #define directive............

Is This Answer Correct ?    2 Yes 9 No

Post New Answer

More C Interview Questions

what is the diff b/w static and non static variables in C. Give some examples plz.

3 Answers   Wipro,


Differentiate between #include<...> and #include '...'

0 Answers  


What is function in c with example?

0 Answers  


what is difference between overriding and overloading?

1 Answers  


simple program of graphics and thier outpu display with a want what is out put of graohics in c language

1 Answers   CSC, HCL,






a c code by using memory allocation for add ,multiply of sprase matrixes

0 Answers  


Explain what will be the outcome of the following conditional statement if the value of variable s is 10?

0 Answers  


Differentiate between a structure and a union.

0 Answers   Zensar,


How to avoid structure padding in C?

8 Answers   Tech Mahindra,


When the macros gets expanded?

0 Answers  


How can I get Single byte from 'int' type variable? Can we alter single bit or multiple bits in int type variable? if so, How?

2 Answers  


How do you override a defined macro?

0 Answers  


Categories