Lecture 01 Introduction
Joseph Haugh
University of New Mexico
Course Work
Students in CS-241 author many C programs:
- Lab assignments will be short and simple
- Projects are more interesting and may touch on a wide range of computer applications which have included:
- encryption
- numerical analysis
- databases
- scientific visualization
- artificial intelligence
- genetic algorithms
- games
Course Goals
- Read and apply the C syntax covered in the textbook.
- Without a computer, determine the output of C language source code involving:
- triply nested loops
- conditional control flow
- function calls
- pointers
- arrays
- arithmetic
- logical and bit operators
- structures and memory allocation
- Use a Linux command-line environment to manipulate files, directories, and to edit, compile, run and debug C programs.
- Implement any given algorithm in C with a complexity level equivalent to quicksort or a doubly linked list with accuracy, efficiency and clarity.
Computer Access
- Need to work on a CS Linux machine
- Get a CS account (in addition to your UNM account)
- Use Putty or NoMachine (or some other SSH) to connect:
- moons.cs.unm.edu
- trucks.cs.unm.edu
- B146 machines
- With a CS computer account you can access *.cs.unm.edu and use the CS Linux lab in Farris
How to Get a CS Account
- Email cssupport@cs.unm.edu from your UNM email account. Include:
- A picture of your UNM ID; if you don’t have a UNM ID, then attach a picture of your government-issued ID, showing your photo and full name
- Your UNM ID number
- Your preferred username (lowercase alphanumeric only)
- The CS class number you will be using this account with
- Your status (pre-CS, undergraduate CS, graduate CS, faculty, staff, guest (non-CS major))
Summary
- Go to class and labs
- Keep up with the websites
- Expect some sort of work each week
- Be proactive!
- Form study groups
- Ask questions
- The graders are there to help you
To Do
- Visit course website
- Slides will be posted after the lecture, if not before
- Visit Canvas site
- Contact ARC if you need it
- Get a CS account before lab next week
Programming vs Natural Language
- The entire C vocabulary consists of under 40 reserved words
- There are many libraries, such as
math
and stdio
. However, these are the proper nouns of the language
- A person can be fluent in a language without knowing the vast majority of its proper nouns
- Proper nouns are learned as needed, and can be forgotten when no longer needed
- Like natural languages, programming languages have punctuation and syntax rules (e.g. In C, every statement is ended with a semicolon)
- Programming languages, however, have fewer rules than natural languages
Small Language with Complex Usage
- Programming Languages are much smaller and easier to learn than natural languages
- However, programming languages are primarily used to express complex branchings of conditional logic that far surpass common uses of natural languages
- Logic skills have strong carryover from one programming language to another
Why use C?
- C and C++ are used widely in industry
- Compact language, and does not change (unlike Java and C++)
- C influenced many later languages
- Used in many higher level courses like:
- Networking
- Operating Systems
- Compilers
- Machine Language
- C is “close to the machine”, yet portable
Hello, World!
#include <stdio.h>
int main()
{
printf("Hello, World!\n");
return 0;
}