01-C-basics

01-C-basics - 01 Lecture C basics-Reminder send me a background email subscribe to the class mailing list get a CS account Reading Chapter 1,2,3,4

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
01 - Lecture - C basics ------------------------ Reminder: - send me a background email - subscribe to the class mailing list - get a CS account Reading: - Chapter 1,2,3,4 History -------- The epoch - around 1970 1989 - ANSI C, ISO C89, C90 1999 - ISO C99 - gcc supports almost all C99 Hello, world! -------------- #include <stdio.h> int main(int argc, char **argv) { printf("%s\n", "Hello, world!"); return 0; } compilation: - compile, link, and execute: gcc hello.c ./a.out - compile: gcc -c hello.c or gcc -g -Wall -c hello.c - link: gcc hello.o or
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
gcc -g hello.o -o hello - link multiple files and library: gcc -g myfile1.o myfile2.o -lm -o myprogram preprocessing: - part of compilation - process lines that begin with ’#’ - can be invoked separately with cpp or gcc -E function definition - return type - argument list - function body - functions can only be at the top level (file scope) main() - the only function that a C program will execute - other functions can be called from main() Using multiple functions
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 10/07/2008.

Page1 / 5

01-C-basics - 01 Lecture C basics-Reminder send me a background email subscribe to the class mailing list get a CS account Reading Chapter 1,2,3,4

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online