CGS 2423: C For Engineers -- Fall 04
Frequently Asked Questions


To ask a question, email to: giri@cs.fiu.edu


Assignment #3

Oct 09:
 Question: 
  When I use the "pow" function in my program, even if I 
  include math.h, it gives the following error message on 
  the Linux machines. 

/tmp/ccccFaVn.o(.text+0x8c): In function `main':
: undefined reference to `pow'
collect2: ld returned 1 exit status

  What am I doing wrong?

 Answer: 
  There is nothing wrong with your program. When you compile the
  program on Linux, instead of using "gcc Program3.c" and
  then running "a.out", do "gcc -lm Program3.c" followed by
  "a.out". 
  

Assignment #2

Sep 26:
 Question: 
  When I run my program, it seems to output very large numbers? 
  For example, I input a value of 125mph, and my output is 
  an extremely large and strange number such as 1.2300000e25.  
  Even if I input the value zero i still get a large strange number.  

 Answer: 
  The problem is in the scanf or fscanf statements. If you have a
  statement such as "fscanf(inFile, "%1f", &miles);"
  then replace it with "fscanf(inFile, "%lf", &miles);"
  where the number 1 is replaced by the letter l (ell).