Anil Varma -: I have defined an enum_TREND_STRENGTH and defining a variable of this enum type 'trendStrength'. Since I have not initialize the variable, getting warning message: possible use of uninitialized variable 'trendStrength'. How can I avoid this warning ?
You avoid it by obviously initializing it! Just set it to a default value by assigning it one of its enumerations;
enum ENUM_FRUIT { _APPLE_, _BANANA_, _ORANGE_, _PEACH_ }; ENUM_FRUIT myFruit = _ORANGE_; // Initialise the variable
However, make sure the problem is not in fact problems in your code logic that is not assigning a value in each case. Consider the warning a possible call to attention of problematic code.
Fernando Carreiro:
You avoid it by obviously initializing it! Just set it to a default value by assigning it one of its enumerations;
However, make sure the problem is not in fact problems in your code logic that is not assigning a value in each case. Consider the warning a possible call to attention of problematic code.
Sorry for late reply Fernando
Yeh it worked fine. Thanks a lot.
Anil Varma -: Sorry for late reply Fernando Yeh it worked fine. Thanks a lot.
You are welcome!
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi Friends
I have defined an enum_TREND_STRENGTH and defining a variable of this enum type 'trendStrength'.
enum_TREND_STRENGTH trendStrength;
Since I have not initialize the variable, getting warning message: possible use of uninitialized variable 'trendStrength'.
How can I avoid this warning ?
Thanks for your guidance.