Adv procedural programming
This presentation is the property of its rightful owner.
Sponsored Links
1 / 29

Adv Procedural Programming PowerPoint PPT Presentation

  • Uploaded on
  • Presentation posted in: General

Adv Procedural Programming. C Fundamentals. Variables. All variables utilized by a C program must be defined. TypeDef Var Name f loat Var double Var int Var long Var c har Var c har Var [X]. Integers.

Download Presentation

Adv Procedural Programming

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

Adv procedural programming

Adv Procedural Programming

C Fundamentals



All variables utilized by a C program must be defined.

TypeDefVar Name







int defines an integer value or whole number, a value without a decimal point.

Values defined as integers are stored in memory using 2 bytes of storage and can hold values from 32,766 to -32,766.

The first bit of storage is used to identify the sign of the value.



long identifies an integer value that is stored utilizing 4 bytes of storage. As such it can store 231 to -231(2,147,483, 647 to 2,417,483,648).

Again the first bit is utilized to define the sign of the value.



float is used to define a decimal value that is stored in 4 bytes of memory. The first three bytes are the mantissa the remaining byte stores the exponent.

2.295 = 2.295e101

22.95 = 2.2295e102



Double is used to define very large decimal values, 1.7e-308 to 1.7e308



char values are actually stores as integers -128 to 127 which represents the ASCII value of the character.



Using this statement you can rename a data type in order to make it easier to use.

typedef unsigned char xchar;

xchar variable;



Not only used to output numbers and character stings but also used to format output.

printf(“print this”);

Output is formatted using escape sequences, a backslash followed by a character.



Commonly used escape sequences.

\n – The newline character moves the cursor to the next line.

printf(“Print This\n”);

\t – The tab sequence inserts a tab between the desired characters.




Numbers are formatted using format specifiers.

  • %d - Format integer as decimal

  • %f – Format float as decimal

  • %x – Format integer as a hex value

  • %5.2f – Format a float as 5 digits with 2 decimal points

  • %5f – Format as a float with 8 digits and now decimal points.

Arithmetic operators

Arithmetic Operators

+ - Addition

- - Subtraction

* - Multiplication

/ - Division

% - Modulus (Remainder of Division operation)

Relational operators

Relational Operators

== - Are two values equal to one another

< - Greater than

<= - Greater Then or Equal to

> - Less than

>= - Less than or Equal to

!= Not Equal to

Order of operations

Order of Operations

( ) – Parenthesis, everything inside the parenthesis is completed first

^ - Exponent

  • - Negation

    % - Modulus

    *, / - Multiplication, Division

    +, - - Addition, Subtraction

Assignment statements

Assignment Statements

Sum = 0

Sum = VarA + VarB

These are both statements that assign a value to the Sum variable

Decision structures

Decision Structures

if – then : A single decision structure if the condition is true execute the code, it its false don’t execute the code.

if (A == B)

printf(“Look What You Did/n”);

Decision structures1

Decision Structures

if – then – else : A two decision structure if the condition is true execute the code, if it’s not then execute some other code.

if (A == B) then

printf(“Look What You Did/n”);


printf(“Opps You Did This Instead/n”);

Decision structures2

Decision Structures

Switch - A structure utilized in place of a nested or chained if-then-else structure to react to several different values of a condition. The major drawback to this structure is its limitation to the use of integers.

Switch (Var1)


case 1:

printf(“It’s a 1/n”);



printf(“It’s a 2/n”);





Iteration is another way of referring to repetition or basically repeating selected instructions. There are two basic types of structures utilized when performing iteration:

Determinate – you know exactly how many times you want to repeat the operations.

Indeterminate-You repeat the operations until a condition is meet but don’t know how many times specifically.

Determinate structures

Determinate Structures

Remember these structures are used when you know exactly how many times you want to execute the operations.

for(var = initial value, terminating value, increment)

for(int X = 0, X < 10, X++)

This loop will execute 10 times and then stop

Indeterminate structures

Indeterminate Structures

These structures are utilized when you don’t know exactly how many time you want the execute the operations. You also have to include a terminating condition that when meet causes execution to stop.

Two basic structures pre-test where the condition is examined prior to execution and post-test where the condition is examined after the loop executes at least once.

Indeterminate structures1

Indeterminate Structures

Standard Pre-Test structure of a while loop. While the condition is true then execute the statement or statements.

while (condition is true)




Indeterminate structures2

Indeterminate Structures

A post-test structure that executes the body of the loop at least once the second repetition dependent on the outcome of the test.





} while (conditon)



Before being used by a program a function must be declared sand a function prototype must be included in the program.

Function name (data type parameter name)

return type function name (data type parameter name)



Functions are called using the function name and the arguments or data that is sent to the function.

FunctionName (arguments)

Functions can appear at the top or the bottom of a program usually the function declaration is place at the top of the program while the function itself is placed at the bottom of the program.



A function is defined by its header which his located at the top of the function and is similar to the function declaration.


void Function(Value1, value2) --- Header


Function Body


Program development

Program Development

  • Planning

    What has to be done, what information is to be delivered to the user. When is it needed, how will it be used, what format does it need to take.

  • Analysis

    How is the information currently gathered, does it exist and where does it reside, what format does it take. How is it ordered, what security is needed. What data is needed and what format does it need to be in.

Program development1

Program Development

  • Design

    How will the new system work what procedures and functions will be used what order will the operations take

  • Implementation

    The program is actuality developed, tested, debugged and refined

Program development2

Program Development

  • Maintenance

    The program is changed according to business needs and any problems that were missed in testing are corrected

  • Login