Line 4: | Line 4: | ||
have been paraphrased. | have been paraphrased. | ||
− | + | == ''1/16/09, Friday'' == | |
+ | '''Q: "Where is the 'header file'?"''' | ||
+ | The header file is within the #include<> statement. | ||
− | + | '''Q: "Are the two parameters "argc" and "argv" required within the "main" function?"''' | |
− | + | No, they are not required, unless the programmer needs to use data which was typed after the execution of the program. | |
− | + | ||
− | Q: "Are the two parameters "argc" and "argv" required within the "main" function?" | + | |
− | + | ||
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 | ||
from the user through the commands "scanf()" (see ''man scanf''). | 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. | *Note that the names "argc" and "argv" are a widely used convention, and changing their names is extremely discouraged. | ||
− | Q: "Within the line, | + | '''Q: "Within the line,''' |
− | + | '''int main(int argc, char * argv[])''' | |
− | + | '''{''' | |
− | + | ''' ...''' | |
− | + | ||
− | + | '''What does the '*' between 'char' and 'argv[]' represent?"''' | |
− | + | 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 20:56, 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, Friday
Q: "Where is the 'header file'?"
The header file is within the #include<> statement.
Q: "Are the two parameters "argc" and "argv" required within the "main" function?"
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?"
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.