How to initialize variable globally? accessible globally..
How to initialize variable globally? I want a variable to be accessible globally and its value should already be initialized. Is it possible?
if yes.. Then how can we do that?
How to initialize variable globally? I want a variable to be accessible globally and its value should already be initialized. Is it possible?
if yes.. Then how can we do that?
Â
You can define a variable as a global variable that will be available in whole program and you can access it any time and anywhere in the program. You need to define it on the start of program and then you can use it over and over in the program but keep in mind that it perform complication in programs and is not used due to these reasons you need to use it carefully and you then will be able to use the value as you need.
As this is available in whole program so it will be more demanding for care as if you have used it on some other place then your program may not work correctly and there can be errors in your code. So the best thing to do is to use a variable within a function and it is better for code. Although you can define it globally as per your require.
You can just simply define it and then you will be able to use it globally.
Michel joran.
Â