How to check if a variable has been initialized in C?

C does not have this ability. You have two main options:

A sentinel value

For example, if you know that the value of c will never be negative, then initialize it to -1, and test that for that.

Add another variable

Create another variable bool we_set_c_to_something = false; and then set it to true when you write to c.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)