Introduction to Computer Science - Fall 2009
CSCI 151
Lab 1

  
Objectives:

Introduction to LINUX ,
emacs editor;
Compiling and executing C code.   
You don't need to submit this Lab Assignment. The first Lab Assignment that you will submit will be next week.
Lab Practice:
Part 1
  1. Login to the system using your login name and the initial password
  2. To change the password, type the following at the LINUX prompt
    yppasswd
    and follow the instructions.

  3. Emacs Editor:
    Open emacs by typing the following at the LINUX prompt
    emacs hello.c &
    hello.c is the name of the file. Remember that a C program file name should end with an extension .c
    You can always open Emacs Tutorial through the Help Menu.
  4. Type in the first C program that will print Hello World!
    Here is the program:

    /* My first program in C
    This program will print Hello World! */

    #include < stdio.h >

    /* function main begins program execution */

    int main()
    {

    printf ( "Hello World!\n" );

    return 0; /* indicate that program ended successfully */

    } /* end function main */

  5. To save your file use the File menu: File->Save


  6. To compile and run your C program read on how to compile and run C program

  7. Compile and run your program hello.c

  8. Basic file and directory manipulation commands.
    You will learn the following commands:


  9. Try to use these commands. Do the following:

Part 2

In this part we will continue to practice to use emacs editor and we will write the C program that uses standard library function scanf to obtain two integers typed by a user at the keyboard, computes the sum of these values, and prints the result using printf