Unit 1 BCA Clang
Unit 1 BCA Clang
Lec - 1
Unit - 1
Introduction to Programming Language
Fundamentals
Topics Covered:
• Basic Introduction of Programming Language
• Types of Programming Language
• Algorithms
• FlowCharts
Basic Introduction of Programming
Language
• A programming Language is a formal computer language or
constructed language designed to communicate instructions to
machine, mainly computer.
• Programming language can be used to create programs to control the
behaviour of machine to express algorithm.
• C is a high level and general purpose programming language that is
ideal for portable applications.
• C is a procedural programming language.
Types of Programming Language
• There are mainly 3 kinds of
programming language:
• Machine Language(Low Level)
• Assembly Language(Middle Level)
• High-level Language(High Level)
Machine Language(Low Language)
• Low-level programming languages are languages that provide little to
no abstraction between the language itself and the processor's
instructions. In other words, these low-level languages closely
resemble the machine code and are hence referred to as 'close to
hardware'. The advantage here is that the processors can run low-level
programs directly, without the need for an interpreter or compiler. This
is why programs written in low-level programming languages are
extremely fast to run.
Disadvantages of algorithm:
• Writing algorithm takes a long time.
• An Algorithm is not a computer program, it is rather a concept of how a program
should be.
To-Do List
• Write an algorithm to find out if the number is odd or even.
• Write algorithm to find the cube of a number.
FlowCharts
• A flowchart is a diagram
that depicts a process,
system or computer
algorithm.
Example of FlowChart
To-Do List
• Draw a flowchart to add two number entered by the user.
• Draw flowchart to find the largest among three different number
entered by the user.
To-Do Questions
• Write an algorithm and then draw a flowchart for finding average of
10 numbers.
• Write the Difference between Algorithm and Flowchart.
C-Programming
Lec - 2
Unit - 1
Introduction to Programming Language
Fundamentals
Topics Covered:
• Introduction to C
• History
• Structure of C programming
• Translator and Assembler
• Compiler
• Interpreter
History of C language
• C programming language was
developed in 1972 by Dennis Ritchie
at bell laboratories of AT&T (American
Telephone & Telegraph), located in
the U.S.A.
Take A = 10 and B = 20
Relational Operator
Operator Description Example
== Checks if the values of 2 operands are equal or not A == B is not true
!= Checks if the values of 2 operands are not equal or not A != B is true
> Checks if the value of left side is greater than the right side A > B is not true
< Checks if the value of left side is less than the right side A < B is true
>= Checks if the value of left side is greater than or equal to the A >= B is not true
right side
<= Checks if the value of left side is less than or equal to the A <= B is true
right side
Assignment Operator
Operator Description Example
= assign the value to variable x = 30
Logical Operator
Operator Description Example
&& AND operator. If both the operands are 1 then condition is A && B is false
true
|| OR operator. If any one operands are 1 then condition A || B is true
becomes true
! NOT operator. Used to reverse the logic of any operation !(A && B) is true
Assume A = 1
and B = 0
Increment and Decrement Operator
• Suppose, A = 10
• Increment Operator
• A++ , ++A = 11
• Decrement Operatior
• A-- , --A = 9
Ternary Operator
• It takes 3 arguements to perform
operation
Type Casting
• Type casting is used to convert from one type to another
• There are 2 type of Conversion
• Implicit Type conversion
• Explicit Type conversion
Implicite Type Casting
• Automatic Type casting.
• Done by the compiler on its own.
• No loss of data
• Bool->char->short->int->long->double
Explicit Casting