Frequently Asked Questions in general


  1. What machine and compiler should I use?

    Your program will be evaluated only on machines in MSEE190. And gcc will be used for compilation and linking. It is recommended that you check your program with them before homework submission.

    For working on MSEE190 machines, students can either directly logon on them or can connect to them through SSH (SecureCRT etc).

  2. How can I connect to the machines in MSEE190 using SecureCrt?

    Please check the ITaP help page http://help.itap.purdue.edu/viewarticle.php?articleid=1534&refid=7 to see the steps for using secureCrt. Though it describes the procedure for changing permission on your website, the general technique for using secureCrt is the same. Follow steps 1 – 4 given in the specified link to get started. Check what should be the hostname in your case from FAQ 1.

  3. Where can I download the SSH client?

    go to https://www.purdue.edu/securepurdue/download/ , and download and install Secure CRT

  4. How can I make executible file from my source code?

    In a path where the source is located, enter

    gcc [C source]

    This will produce a.out executible file. To run, enter

    ./a.out

    For more options for compilation and linking, refer to gcc man page by excecuting

    man gcc

  5. Do I need to leave comments in the source code of homework?

    You should comment in your code in a way that who knows C programming can understand it without much effort. If the source is too complex to understand but you don't leave any adequate comments in it, you may receive a penalty on your homework grade. However, it does not mean you have to comment line by line. You don't need to leave comments on a statement or a routine that tells what it does by itself. Following is an example.

    1. Bad comments

      strcpy(temp, str1); // copy str1 to temp

      strcpy(str1, str2); // copy str2 to str1

      strcpy(str2, temp); // copy temp to str2

    2. Better comments

      // swap str1 and str2

      strcpy(temp, str1);

      strcpy(str1, str2);

      strcpy(str2, temp);



  6. How to run a program in the shell under linux?

    After you run "gcc" to compile your source file, you'll get the default executable file "a.out". To run your program, do not just type "a.out" and enter directly. Use "./a.out" instead. (The prefix "./" indicates the path of current directory if you and your program are at the same directory)You need to add a path to your program before the executable file name to run a linux program in the shell.

  7. What do you mean by "Reading from standard input"?

    Standard input (std) is data (often text a user types)going into a program. A program under Linux can read these data just like reading from a file. A virtual file stream (FILE * stdin) is created and opened automatically before a program begins to run. So programmers can use fscanf(stdin, "some_format", ...) to get what a user types into the program.

  8. My program is compiling correctly but when I try to execute it I get a "Segmentation Fault" message. How do I debug?

    You can debug your program in a GCC environment using the GNU Debugger popularly known as GDB. Using GDB you can find out the exact line in your program that causes segmentation fault or other errors. The follwing steps briefly describe how to use GDB.

    1. In order to debug your program using GDB you need to first compile it with the "-g" option. Complie your program as
      "gcc -g myProgram.c" where "myProgram.c" is the program that you want to debug.
    2. Once your program compiles without error messages, type the command "gdb a.out" in your shell and press Enter.
    3. You will now see the "gdb>" prompt in your shell. Typically, you will first notice the copyright/license information printed by GDB. The prompt then waits for user input.
    4. In the "gdb>" prompt type "run" and press Enter.
    5. Your program now starts executing as it would run in a shell.
    6. Follow the messages/prompts given by GDB and try to locate the error in your program.
    7. Once the program stops executing, you can check whether it is normal termination or error condition from the GDB messages.
    8. Finally follow the prompts given by GDB to quit the program.
    9. ** Additional information about GDB may be found by typing "man gdb" in your shell.



For more questions, please email at ee264