Since this value is defined as a global variable (not inside a function) and is an integral data type (not part of an object/struct) it is safe to assume 'predigit' is initialized as zero by the compiler. I guess the author of the C code wasn't sure and tried to initialize both variables (just in case) ... and got it wrong. However it doesn't matter, because the '= 0' doesn't actually add anything.
test #1 - define at global scope
prints '0 9', not 9 9#include <stdio.h> int value1, value2 = 9; void main(void) { printf("%d %d\n", value1, value2); }
test #2 - define in function
may print '996873600 9' or '-1944996480 9' or '-51174016 9'#include <stdio.h> void func(void) { int value1, value2 = 9; printf("%d %d\n", value1, value2); } void main(void) { func(); }
In reply to Re^3: porting C code to Perl
by Monk::Thomas
in thread porting C code to Perl
by Discipulus
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |