Sie sind auf Seite 1von 14


By: Steven Graham

What is C Programming? Writing your first program Dissecting your first program.

More C Programming basics.

Moving forward

What is C Programming?
C Programming is considered a high level language. A high level language is readable on multiple machines and is structured off human language, not computer binary. C is simple, efficient and extremely powerful. Many institutions for higher learning believe C is the best introduction language for computer programming.

Where is C Used?
The C language is used all around us!
Operating Systems Computer Applications Interactive Websites Robotics

Computer Graphics
Databases Data Compression

Before You Can Start...

How can we write C Language code without something to write it in!?
Visit THIS webpage and download Dev

Download should begin automatically

Open Dev C++ when download is


Writing Your First Program

The best way to learn C is to write C! Write the code given on the next slide

EXACTLY how you see it . You may not understand any of what you are writing, but that is perfectly fine, and expected. When you are done writing the code, hit F9 on your keyboard!

#include <stdio.h> #include <stdlib.h>

Int main(void){ printf(Look mom, I wrote code!); system(pause); return 0; }

Dissecting Your Code

If all went to plan, a black box with Look

mom, I wrote code! popped up on your screen. Let us look at each piece of code and what it means. #include<stdio.h> #include <stdlib.h>
These will be required in all code you write. This code allows your program to compile and run


Dissecting Your Code contd

int main(void) {
This code tells the computer that what you are

about to type is the main code of the program. You are really creating a main function but you wont need to understand this till much later. For awhile, all of your code will fit inside this main function. The { is very important
Anything writing between the { } is read and executed by the computer.

Dissecting Your Code contd

printf(Look mom, I wrote code!);
printf is a code that will print something on the

screen. Anything written inside the parentheses, between quotation marks, will appear on your screen. Dont forget to close your parentheses and quotation marks. The ; is used to end each line of code. You must use them following each line of standard code.

Dissecting Your Code contd

The system(pause) code isnt required but is

used so the user can see what task the computer completed. This code simply tells the computer to pause until the user hits a key on the keyboard. Take system pause out of your code, and run it again.
Did you notice that the black box popped up and disappeared almost simultaneously?

Dissecting Your Code contd

return 0;

return 0 ends our code in our main function. It lets our program know that we are done with all

our tasks and there is nothing for it to return. Since our main function was (void), this was not required; however, get into the habit of writing this line of code until you learn functions. The } tells the computer we are done with our code.

More Programming Basics

There are 3 types of variables you should be

aware of moving forward: int, float, char. Ints are whole numbers. Floats are numbers with decimals. Chars are letters or words. You will use these variables to do simple math in future lessons.

Moving Forward
Practice, practice, practice! The code we learned today was very simple

but you MUST practice it over and over again. Try typing different messages or multiple messages in one program. See what happens when you type: printf(Look mom, I wrote code!\n);