0% found this document useful (0 votes)
9 views7 pages

Data Types and Decision Making

The document provides an overview of data types in programming, including basic types like integer and floating-point, derived types, and enumerated types. It also discusses the concept of variables, constants, operators, and decision-making structures such as if statements and loops. Additionally, it outlines the syntax for various programming constructs in Objective-C.

Uploaded by

nagasrivignesh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views7 pages

Data Types and Decision Making

The document provides an overview of data types in programming, including basic types like integer and floating-point, derived types, and enumerated types. It also discusses the concept of variables, constants, operators, and decision-making structures such as if statements and loops. Additionally, it outlines the syntax for various programming constructs in Objective-C.

Uploaded by

nagasrivignesh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Q3.

Data type and Decision making

A ClanifAoation of Data Types

Bosie Tipe- Thuy aue anthmetic types anol consist of


the two types integr types and
fioating point types.
Void Type- The type specifer voidl indicates that
ho Valve is available

Deived Types- They incluole pointer types, amay type.,,


sthucture types, funchion types, union
types.

Enumerated types- Thy are again arith meie typeA , and


thy are used to defne variabluA that can
only be asigned to cetain discrete inteqer
valves troughaut the program.

4 Data Typet
char 1 byte
unsignad ohar - 1 byte.
signud ohar -1 byte
int - Q or4 byte
unsigned int - 2or 4 bytea
Shert - l bytel
ursignad shart 2byteu
long 4 bytu
UAigned lonq - 4 bytea
Page

Floating paint Types- float- 4byte


double - 8 byte
long double - 10 byte

Void Type - funation returm au voidl


funchion orgumants ad void

Voriables ’

Aviable isnothing but a name qiven toa storage


area that our prag rams manipulate

Each variable in objechive -C hau a specific type.


which detemine it's size and layout of the variable's
mamory(range of valuer
Volues that
that aan be &toredwihin
that memory and &et of aperation that can be
cpplied to he vaiable)

Basic vaiable typel includla ’ char, int. foat, dowble


Void.

# import <Foundation Foundation.h)


/Nouriable declaration
exterm int a,bj
extem intc
exten fioat fi
int main

/ vaiable dafinition
int a , bj
int ci
float fi
/vaniable initialization
as 10;
b= 20
C= o+b:
NsLog (@"value of c od \n' c)
f= 20.o/3.0
NSLog (aO" valve of f: %fn"f)i

Constants

Const ants refr to fxed valves that the progrom may


not altur during it's execution
Constonts can be of ouny of the basic olata types,
ike indegu [Link] constant, charactu
Constant enumeation constant, sting literal ete.

Opurators
Operators inclucle Arithnetie opuators
Logical opeators
Relational operators
Bihwise operators
Assigrmant apuratore
MiscallansaUs opuaton
sizeof ()
-Xoperator
opurator
2: operator
* Deision Making -Brarching
Decision making stuchures require a programmers to specify
or more condihonto be evaluated and
tested bs the program, along with the statement/
statuments to be cxecuted if th condition is
detumined to be tue, and ophonalls othw Statununts
to be executed if the condition is oletuminad to be.
false.

condition

fcondihon if condihon
is true js false
condihional
ode

Typs of decision making statements

sks if statement-
if (boolean-exprnion)
7statemants will exeeute f the boolean exp is tue
3
page

if else statenent-s

if (boolean-expreuion)a
state ments will execute if bolean exp is true

else

lstatements wid execute of boolean exp is folse

Nested if statement

if (boolean- expreion 1)
/Executes when boolean exp1 is true

#Cboolean expreuion 2
Z Execwtes whn boolean exp2 is true

Suwitch statemnt
Switch
Cexpreion)
corutant-exprssion
statements ();
break
Myou Can have ay sUch no. of oae statements
dafault:
ldefault is ophional
statements ();
break

* Decision Making-hooping
looping statement allows us to exeoute a statemant or
qroup of stateneunts aultiple tineu

Condihional
Code

if condihon
's ue
condiion

if condihon
is false
Poge

Typu of looping statements


While loop
while loondition )
Statuments (s)

For Joop
or (init Candihion, increment)
statemunts )

Do cuhile loop

oo

Statements (s)

while (oandition)

You might also like