Getting Started C

What is C?

C is a rather old programming language (1972, Richie, Bell Labs)

Originally designed as a systems software plaform (OS and the like)

Procedural, block oriented language (no object oriented programming)


Dennis Richie Inventor of the C Programming Language

Getting Started C

Why learn C?

Small, extensible language. Progenitor of many languages.

Many applications and much support due to its age and general use.

Many tools writen to support C development.

Close to the hardware, programmer manages memory

Common embedded systems language

Can be fast, efficient (most cited reason)

Getting Started C

Disadvantages of C?

Flexible language allows programmers to commit many sins without warning

Hard to debug, fix code

Speed depends on programmer as much as the language

Managing memory can be dangerous, difficult, painful

Lacks modern features (OOP, exceptions, etc.)

Getting Started C

gcc: gnu compiler

There are others, but this is a good one and it is free (and on all Linux distributions, can be added to the MacOS and runs under Cygwin on windows)

Getting Started C

Example gcc usage

gcc file.c

if it compiles, makes an executable called file.out in the same directory as file.c

can run file.out by typing ./file.out (meaning the file.out in the current directory)

gcc -o run file.c

make the executable called myExec

Getting Started C

Compilation errors

You didn't follow the rules.

You have to fix the source code before the compiler can make an executable.

Errors can be cryptic, but at the very least they list the line number where it went wrong.

Doesn't prevent run-time errors.

Getting Started C


Sublime Text
Visual code...