/////////////////////////////////////////////////////////////////////////// // Homework:2 // Exercise:2 // // summary: just making sure you know how initialization works // // // Create three files for this exercise, two source code files (file1.cc, file2.cc) // and one header file (decl.h). // // Both source code files will contain variable definitions, and the header file // should be #include'd by both source code files, and should contain declarations for // *all* non-static file-scope variables // // Basically, you'll make the following definitions in // // file1.cc: should contain the main() function, code to output all the variables // declared, and 3 succesive calls to the function: void printvars() // defined in file2.cc // file2.cc: has the definition of function: void printvars(), which takes no // arguments, returns nothing, but prints out *all* variables within its // scope - you should make all the definitions listed below, add declarations // of all non-static file-scope variables to decl.h, and then see what // variables can be printed out by printvars() // // // (1) define a global, non-static 5-element character array named str1 in file1.cc, // and initialize all elements but the last to 'q', and set the last element to hold the // null character '\0'. // (2) define a global, static int x, without explicitly initializing it, in file1.cc // define a global, static int x, explicitly initializing it to 18095, in file2.cc // // (3) define a local, non-static int variable in printvars() named i1, without // initialization. increment it by 1 on each call to printvars() // // (4) define a local, static int variable in printvars() named i2, // without initialization. increment it by 1 on each call to printvars() // // (5) define a local, static double array called f2[10] in printvars(), initialized // to {1,1, 1}. on every call to printvars(), increment the i'th element // of f2[] by i. // // // // // /////////////////////////////////////////////////////////////////////////// #include int main(int argc, char *argv[]) { return 0; }