(New page: == Lecture Questions == The following are some questions asked during class, followed by the professor's responses. The questions and answers have been paraphrased. 1/16/09 Q: "Where ...)
 
Line 1: Line 1:
 
 
== Lecture Questions ==
 
== Lecture Questions ==
  
Line 5: Line 4:
 
have been paraphrased.
 
have been paraphrased.
  
1/16/09
+
'''1/16/09'''
  
 
Q: "Where is the 'header file'?"
 
Q: "Where is the 'header file'?"
 
 
A: The header file is within the #include<> statement.
 
A: The header file is within the #include<> statement.
  
 
Q: "Are the two parameters "argc" and "argv" required within the "main" function?"
 
Q: "Are the two parameters "argc" and "argv" required within the "main" function?"
 
 
A: No, they are not required, unless the programmer needs to use data which was typed after the execution of the program.
 
A: No, they are not required, unless the programmer needs to use data which was typed after the execution of the program.
 
   Later on in the class, the main function may be defined as "int main()" or "int main(void)", and data may be retrieved
 
   Later on in the class, the main function may be defined as "int main()" or "int main(void)", and data may be retrieved
Line 26: Line 23:
  
 
     What does the '*' between 'char' and 'argv[]' represent?"
 
     What does the '*' between 'char' and 'argv[]' represent?"
 
 
A: The '*' denotes a pointer.  Pointers will be discussed later on in the class,
 
A: The '*' denotes a pointer.  Pointers will be discussed later on in the class,
 
however, at this time it must simply be known that "char * argv[]" is an array of arrays,
 
however, at this time it must simply be known that "char * argv[]" is an array of arrays,
 
which is also known as a two-dimensional array.
 
which is also known as a two-dimensional array.

Revision as of 21:50, 16 January 2009

Lecture Questions

The following are some questions asked during class, followed by the professor's responses. The questions and answers have been paraphrased.

1/16/09

Q: "Where is the 'header file'?" A: The header file is within the #include<> statement.

Q: "Are the two parameters "argc" and "argv" required within the "main" function?" A: No, they are not required, unless the programmer needs to use data which was typed after the execution of the program.

  Later on in the class, the main function may be defined as "int main()" or "int main(void)", and data may be retrieved
  from the user through the commands "scanf()" (see man scanf).
  *Note that the names "argc" and "argv" are a widely used convention, and changing their names is extremely discouraged.

Q: "Within the line,

   int main(int argc, char * argv[])
   {
     ...
   }
   What does the '*' between 'char' and 'argv[]' represent?"

A: The '*' denotes a pointer. Pointers will be discussed later on in the class, however, at this time it must simply be known that "char * argv[]" is an array of arrays, which is also known as a two-dimensional array.

Alumni Liaison

Correspondence Chess Grandmaster and Purdue Alumni

Prof. Dan Fleetwood