Line 1: Line 1:
 
[[Category:ECE264Spring09lu]]
 
[[Category:ECE264Spring09lu]]
  
== Lecture Questions ==
+
== [[ECE264]] Lecture Questions, Spring 2009, Prof. Lu ==
  
 
The following are some questions asked during class, followed by the professor's responses.  The questions and answers
 
The following are some questions asked during class, followed by the professor's responses.  The questions and answers
Line 37: Line 37:
 
'''Q: Why is the '%s' specifier used within the printf() statement?'''
 
'''Q: Why is the '%s' specifier used within the printf() statement?'''
 
     The '%s' is the specifier to the printf() statement for a string (see ''man printf'').
 
     The '%s' is the specifier to the printf() statement for a string (see ''man printf'').
 +
----
 +
[[ECE264_%28YungluSpring2009%29|Back to ECE264 Spring 2009, Prof. Lu]]

Revision as of 04:33, 11 July 2012


ECE264 Lecture Questions, Spring 2009, Prof. Lu

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 in the same line as the execution of
  the program from the terminal window.
  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 commands such as "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.

Q: If 'which <program_name> ' is typed in the terminal window, will the name of the current directory be returned?"

   It should not.  If it does, then that is a security issue that must be resolved.

Q: Is an array initialized with size 20, really only of size 19?

   No.  Arrays begin with the index '0'; and although the last element may have index '19', the array is still of size '20'.

Q: Why is the '%s' specifier used within the printf() statement?

   The '%s' is the specifier to the printf() statement for a string (see man printf).

Back to ECE264 Spring 2009, Prof. Lu

Alumni Liaison

Abstract algebra continues the conceptual developments of linear algebra, on an even grander scale.

Dr. Paul Garrett