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 character constants?

0 Answers  


Is it better to use a macro or a function?

0 Answers  


What is true about the following C Functions a.Need not return any value b.Should always return an integer c.Should always return a float d.Should always return more than one value.

11 Answers   TCS,


What is the output of the following progarm? #include<stdio.h> main( ) { int x,y=10; x=4; y=fact(x); printf(“%d\n”,y); } unsigned int fact(int x) { return(x*fact(x-1)); } A. 24 B. 10 C. 4 D. none

2 Answers  


I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.

0 Answers   TCS,


How would you obtain the current time and difference between two times?

0 Answers   TISL,


What is equivalent to ++i+++j?

0 Answers  


write a program to generate 1st n fibonacci prime number

12 Answers  


Explain how do you determine the length of a string value that was stored in a variable?

0 Answers  


Differentiate call by value and call by reference?

0 Answers   Cyient,


What is the difference between realloc() and free()

1 Answers  


Difference between null pointer and dangling pointer?

7 Answers   GE, Wipro,


Categories