Object-Oriented Programming in C

processroguishSoftware and s/w Development

Nov 18, 2013 (3 years and 8 months ago)

94 views

Object
-
Oriented Programming
in C

COMPSCI 253

Spring 2009

Objectives


Learn to program in C


OOP without an object
-
oriented
language


Learn to use tools


Become a proficient linux
-
user

C


General
-
purpose language


Available on most platforms


Written at Bell Labs in 1972


Created for writing Unix operating system


Linux is written in C


A programmer's language


lots of power


minimal checking


Many other languages are written in C

Structure of a C Program


A Java program consists of one or more
classes


A C program consists of a collection of
declarations and functions


main is used to start the program


a program can consist of multiple files


files can be compiled independently


Comes with libraries

Programming Environments


Command
-
line tools


vim, gcc, link, debugger, …


Integrated development environments


Eclipse

helloworld

#include <stdio.h>

#include <stdlib.h>


int main(int argc, char *argv[])


{


printf("Hello World!
\
n");


exit(0);


}

Development Process


Use your favorite editor to create a file whose
extension is
.c


Use
gcc

to create an executable file

gcc main.c

gcc
-
o hello hello.c


Run the program by typing the name of the
executable

a.out

./hello