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 |
how to capitalise first letter of each word in a given string?
How to add two numbers with using function?
how to make c program without a libary? e.g.#include<stdio.h> libary is not in c progaram.
can u write a program in C, which does not use = (eqaul)or any arithmatic assignment(like -=,+=,*= etc) operator to swap to number?
what is array?
How can I make sure that my program is the only one accessing a file?
Why is struct padding needed?
Is fortran faster than c?
What is the purpose of ftell?
What is define c?
What compilation do?
7 Answers Geometric Software, Infosys,
what does the following function print? func(int i) { if(i%2)return 0; eale return 1; } main() { int =3; i=func(i); i=func(i); printf("%d",i);}