initialization - Can't initialize int at 0 in c -
i'm making program image treatment , have variables initialized:
int minr, ming, minb = 255; int maxr, maxg, maxb = 0; printf("%d", maxg);
and when print this, instead of getting 0 should be, 16384 value of maxg. yet, if this:
int minr, ming, minb = 255; int maxr, maxb = 0; int maxg = 0; printf("%d", maxg);
then goes ok.
does know why be? thank you.
the initializer applies 1 declarator follows, not of other declarators in list!
so int = 10, b, * c = null;
initializes a
, c
, b
remains uninitialized.
(by way, reading uninitialized variable has undefined behaviour.)
Comments
Post a Comment