Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

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

Prof. Achala Yash delivered this lecture at Ankit Institute of Technology and Science for Object Oriented Programming course. It includes: Programming, Languages, Low, Level, Machine, Assembly, Structured, Procedural, Object, Oriented, Qualities

Typology: Slides

2011/2012

Uploaded on 07/17/2012

pankarithi
pankarithi 🇮🇳

4.6

(5)

61 documents

1 / 18

Toggle sidebar

Related documents


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

7

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

Machine Language

Processor Specific

Binary Integer Values Understandable by Processor

Debugger can Show Machine Language

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

C Programming Language

Mid Level Language

Structured but Not considered as Structured because of GOTO

statement

No Input or Output Statement

Huge Library of Functions at Run Time

C Compiler is Available for Almost Every Processor

Compilers for other Languages are written in C Language

Supports Object Oriented Programming

Developed By Dennis MacAlistair Ritchie (68, alive) in 1972.

"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

Data Types

int A;

// Signed Integer Data Type?

unsigned int B;

// Unsigned Integer Data Type?

char C;

// Character Data Type or Signed 8-bit Integer Data Type

float D;

// Floating Point Data Type with Single Precession?

double E;

// Floating Point Data Type with Double Precession?

?Consult compiler’s help for the range

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

Control

if(Expression){

Statements if Expression is True

}

else {

Statements if Expression is Not True

}

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;

}

Exercises

Adding two Numbers

Finding the Maximum of Two Numbers

Printing Numbers from 10 to 1 with a Loop

Finding GCD of Two Numbers

Finding LCM of Two Numbers

Summing a Sequence

Summing a Series

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);

}

Exercises

Adding two Numbers

Finding the Maximum of Two Numbers

Printing Numbers from 1 to 10 without a Loop

Printing Numbers from 10 to 1 with a Loop

Finding GCD of Two Numbers

Finding LCM of Two Numbers

Summing a Sequence

Summing a Series