Docsity

Programming Languages and C-Fundamentals of Object Oriented Programming-Lecture Slides, Slides of Object Oriented Programming

Partial preview of the text

Download Programming Languages and C-Fundamentals of Object Oriented Programming-Lecture Slides and more Slides Object Oriented Programming in PDF only on Docsity!

Outline of the Lecture 02 – 03

1 Programming Languages

2 C Programming Language

3 Example

4 Exercises

5 Pointers

6 Recursion

Programming Languages

Low Level Languages

Machine Language Assembly Language

High Level Languages

Structured & Procedural Languages

Very High Level Languages

Object Oriented Languages

Mid Level Languages

Qualities of Low Level & High Level Languages

Assembly Language

Processor Specific

Symbolic Representation of Machine Language Instructions

Assembler and Linker Convert Assembly Language into

relocatable Machine Language Code to be Executed by

Operating System.

Structured & Procedural Languages

Advanced Data Handling and Manipulation

Necessary Control Structures to avoid a GOTO statement.

Function/Subroutines and Recursion

"hello, world" C Program

#include <stdio.h>

int main (void) {

printf ("hello, world\n"); return (0);

"hello, world" C Program

#include <stdio.h>

// Header File for Standard Input & Output Library

int main (void) {

// Entry Point for the Program, the main Function

printf ("hello, world\n"); // Function from the Standard Input & Output Library return (0); // main Function Should Return an Integer Value

// End of the main Function

Assignment

variable = variable;

variable = Expression;

Augmented Assignment

+=, A += B; // A = A + B; Addition -=, A -= B; // A = A - B; Subtraction *=, A *= B; // A = A * B; Multiplication /=, A /= B; // A = A / B; Division %=, A %= B; // A = A % B; Modulus or Remainder &=, A &= B; // A = A & B; Binary AND |=, A |= B; // A = A | B; Binary OR ^=, A ^= B; // A = A ^B; Binary XOR << =, A << = B; // A = A << B; Binary Shift Left

=, A >> = B; // A = A >> B; Binary Shift Right ++, A++; // A = A + 1; C = B + A++; Increment After ++, ++A; // A = A + 1; C = B + ++A; Increment Before –, A–; // A = A - 1; C = B + A–; Decrement After –, –A; // A = A - 1; C = B + –A; Decrement Before

Expression

variable operator variable

Expression1 && Expression2; // Logical AND Expression1 || Expression2; // Logical OR Expression1 == Expression2; // Equality Expression1 ~= Expression2; // Inequality Expression1 > Expression2; // Greater value Expression1 >= Expression2; // Greater or Equal value Expression1 < Expression2; // Smaller value Expression1 <= Expression2; // Smaller or Equal value

operator variable

~Expression; // Logical NOT

Loop

for (Assignment;Expression;Assignment) {

Statements if Expression is True

while(Expression) {

Statements if Expression is True

do {

Statements if Expression is True except for the first time

} while(Expression)

Print Numbers from 1 to 10

#include <stdio.h>

int main (void) {

int i; for (i = 1; i <= 10; i++) { printf("%d\n", i); } return 0;

Pointers

Pointer is a variable whose Location could Change.

int *A, B = 10;

// A is a Pointer variable of Integer Type

A = &B;

// A is Pointing to Address of B

printf ("%d\n", *A);

// Prints the value of B

Recursion

int Recusive_Procedure (int counter) {

–counter if (counter == 0) { return (0); } Recusive_Procedure (counter);