What is the best way to initialize a boolean array in C99?
Maybe I can use this, I think.
bool f[5] = {false,};
Is this really okay?
If there is a better way, please let me know.
If you want to initialize your array to "all false"/"all zeros" initial value, you can do
bool f[5] = { false };
or you can do
bool f[5] = { 0 };
Which variant is "the best" is for you to decide. There's no definitively "best" way here. Each one is as good as the other.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With