in c programming a variable declare in between program or some place in program what keyword should we used ?
in c programming a variable declare in between program or some place in program what keyword should we used ?
See the section "Using variables" in the tutorial.
You don't need an extra keyword for declaring a variable, just <type of variable> <name of variable>.
Depending on the location of the declaration the variable will have a specific storage class.
Beginning with C99 selection- and iteration-statements (if, switch, for, while) are considered as blocks and thus the following is also valid:
Bye, AndreasCode:for (int i = 0; i < 10; i++) { /* body of loop */ }
I think that in C we declare variables at the start of the program.
You mean that we can declare a variable at the middle of the main for example?Like C++??
Yes, when compiling with respect to the 1999 edition of the C standard, or later. Besides, even if you are compiling with respect to C89/C90, you would still be declaring variables at the start of blocks like the start of a function, not just "the start of the program" (as in at global scope or at the start of the main function).Originally Posted by std10093
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)