If you are compiling with respect to C99, then you can take advantage of the ability to mix declarations and code, and thus declare variables near first use. You would write:
Code:
FILE *fid1 = fopen("output.log", "w");
even if there was some non-declaration code before this line.
But if you want the code to be compilable with respect to C89 too, then this is not always feasible. You can still declare variables near first use, except that "near first use" may mean the start of the block in which the variable is first used. Consequently, if you do not declare variables too far from where they are first used (e.g., you write functions that do one thing and do it well), you can still get away with not initialising the variables as there is minimal risk that you will use the variable before it has been given an initial value. If you do want to initialise them anyway, yet cannot initialise them with the values that they are supposed to have, then for pointers NULL is a reasonable value. Random "characters, or numbers" would be unreasonable.