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

Consider a language that does not have arrays but does have stacks as a data type.and PUSH POP..are all defined .Show how a one dimensional array can be implemented by using two stacks.

3 Answers   Google,


Write a program in c to input a 5 digit number and print it in words.

11 Answers  


What is restrict keyword in c?

0 Answers  


Why c language?

0 Answers  


How can I split up a string into whitespace-separated fields?

0 Answers  


void swap(int a,int b) { a=a+b; b=a-b; a=a-b; } in this code always gives the same result for all case

9 Answers   Accenture, TCS,


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

1 Answers   IBM,


how should functions be apportioned among source files?

0 Answers  


What is #include stdlib h?

0 Answers  


Explain #pragma statements.

0 Answers  


find largest element in array w/o using sorting techniques.

3 Answers   Zycus Infotech,


What is auto keyword in c?

0 Answers  


Categories