Share this:


C PROGRAMMING

AN INTRODUCTION TO C PROGRAMMING

It is one of the most used programing language in software development area. At the beginning, C was designed and developed for the development of UNIX operating system. Today C has been widely used to develop many types of application software such as basic calculator word processor games, operating system etc.


Editing in C language
  • Editing is a process of writing the C source code. programmers write C source code using editor program. widely used editing programs are Linux, platform via and Emacs.
    On windows platform, we can use Notepad as editor program but most use software package for C such as C++ builder, DOS C++. This software provides complete programming environment forwriting, managing, compiling, debugging and testing C source code. This is known as Integrated Development Environment (IDE)
    Compiling in C language
    The C source code has to be translated into machine language code. Machine language is a language which are in the form of binary numbers that a computer understand. The process of code translation is called compiling. During compilation process, the compiler can detect any syntax error.
    Execution
    The execution stage is where you can run the program to check whether it produce the desired output.This stage can be a testing stage where you can check if you get the desired output.
    C program layout
    Basically, a C program consists of two sections
    1. Pre- processor directives
    2. Main function
EcoleBooks | COMPUTER A LEVEL(FORM SIX) NOTES - C PROGRAMMING
A simple C program
The following program is written in the C programming language which can display the word “program in C is easy”
#include
main()
{
printf(“Programming in C is easy.n”);
}
Sample Program Output
Programming in C is easy.
_
A NOTE ABOUT C PROGRAM
In C, lowercase and uppercase characters are very important! All commands in C must be lowercase. The C programs starting point is identified by the word
main()

Practice Exercise 1: Defining Variables

Operation
Operator
Comment

Value of Sum before
Value of sum after
Multiply
*
sum = sum * 2;
4
8
Divide
/
sum = sum / 2;
4
2
Addition
+
sum = sum + 2;
4
6
Subtraction
sum = sum -2;
4
2
Increment
++
++sum;
4
5
Decrement
–sum;
4

3
Modulus
%
sum = sum % 3;
4
1

ANSWERS: CLASS EXERCISE C5

Practice Exercise 2: Assignments

Answers: Practise Exercise 2: Assignments


Practise Exercise 3: printf() and scanf()

Answers: Practise Exercise 3: printf() and scanf()

Operator
Meaning
==
equal to
!=
not equal
<
less than
<=
less than or equal to
>
greater than
>=
greater than or equal to

EcoleBooks | COMPUTER A LEVEL(FORM SIX) NOTES - C PROGRAMMING
EcoleBooks | COMPUTER A LEVEL(FORM SIX) NOTES - C PROGRAMMING
EcoleBooks | COMPUTER A LEVEL(FORM SIX) NOTES - C PROGRAMMING
EcoleBooks | COMPUTER A LEVEL(FORM SIX) NOTES - C PROGRAMMING
EcoleBooks | COMPUTER A LEVEL(FORM SIX) NOTES - C PROGRAMMING
EcoleBooks | COMPUTER A LEVEL(FORM SIX) NOTES - C PROGRAMMING
EcoleBooks | COMPUTER A LEVEL(FORM SIX) NOTES - C PROGRAMMING

Practice Exercise 4: for loops

PRACTISE EXERCISE 4

for loops

Practice Exercise 5: while loops and if else

COMPOUND RELATIONALS ( AND, NOT, OR, EOR )

COMPOUND RELATIONALS ( AND, NOT, OR, EOR )

COMPOUND RELATIONALS ( AND, NOT, OR, EOR )

THE switch case STATEMENT

Practice Exercise 6

Compound Relational and switch

Answers: Practice Exercise 6

Compound Relational and switch

ACCEPTING SINGLE CHARACTERS FROM THE KEYBOARD

BUILT IN FUNCTIONS FOR STRING HANDLING


Validation Of User Input In C

Basic Rules

The contents of word[] is Hello




Share this:


EcoleBooks | COMPUTER A LEVEL(FORM SIX) NOTES - C PROGRAMMING

subscriber

Leave a Reply

Your email address will not be published. Required fields are marked *

Accept Our Privacy Terms.*