0% found this document useful (0 votes)
3 views13 pages

Understanding C Programming Basics

Uploaded by

Api 123
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)
3 views13 pages

Understanding C Programming Basics

Uploaded by

Api 123
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

OATE

Monde 25 82s

Cuntent Jersion tc:c3(ISoliEc 9219:2024)


44 & moye Cboo, nullp,
aligaas, aliqaof et)
why c is dependent
platox n
Lompiled lanauaae Hhat {Next Code
o machine (ode
Eey0s & pocessoY has diffeeat set ot coomand
&instuctions,
So the machine lode is specihc for difertnt as &

PoceSsox

why c is midle leve language '


+offcs
evel
Ilou
&
leel
high
both

features
bitoise opercators fox wwoxking Qn
Hiah leuel featuycs: eadable Syntax
.
dect hardware .texation(io
level pmgammfag
Diyect
eatures.
memo alless (poimeas
haxdwcre level data
poxtabi lity
Structued progzamming wjth dunctions taaps ete

bhat are Hhe


here axe
te modexs nc? 1c short,
longsigned unsigned,lonlon
A Reyuord in c hat actsas openatax sizeot

es t
LonStarts 1nc
li4enal chax BealCloatdouble) shing
qualifed: const
Sobolic namedMacr
ot
Types chaxacdexs n c
OPsntable Non-pintable (Esc9pe Sequenie.
chara cters)
DATE

25 82s

1 value dlue_
Lyalue must be astorae axea that can he
mdiable non -modiiable ke constants)
e alue Can he any unction thqt Yeuns a

Nalu e Naxiable or expression


existhng

Each eueny openato athca enfoxmio4


&

opeaation will be seturniag valwe. a

2 Cmode) etuns Kemindeg & Temiadea always


akes the siqn ot numexatox

+ numexator is Smalea Haan denominator +hen


default Hhe Yest will be numnerator.

oAly Operates on int.

nCrement /Derrenent

Oe-Rt ya
nnt ,h/s,s.
6

|00 200 200o


Boolean.

seValue.
float
char
double
o Cnul xhoyacten )
Pointe NVLL
DATE

26824

Eveyalue that is Dpn - ero Nalue


short ciycuitia J shaxt hand cx uitinq
hen Locnpler Self cpHmies Hhe exe(uton
S--1--0
0nSs + ||+.
At a0s - tt4 {t 1te // -S,yO,2 ans0

Heae compilex checks the 1 st value of expnS


S+ aue perator s |
is (oR)
Hhen t does not evalucteuyther and Sets
aesul fo
fo tNe false al)

oNumbed syctem
ODeimal
inarg b (befx)
Qtal
9 Hexadeimali 0x eeY
Convexsion
Decmal t einant
2 |3 10L

2 3

Bnam toDeimal
Yn+ [x
Aaish aashiniwaY- 3caospmYSCoe, ed ,in DATE
siy Teleym -SI9q\1 q08 282S

aDecimal to octaloivide hy )
Ea (Sios(?)
6

4yOcta l to Deimgl
E 06z
Gxg+2x
42

le) A - \o
S)Oe&mal to Hexadecmal Divide hy A
B -I

(20) -4
16 ..(45)o F- 5
3) 1 n hoacetimal

Hexaderimal to decimal CiuHpl L )


(20 )tt (')++
t
-2X I6 13 xl6
32t 13
45
b lollL

1S S1 +\ +S
E134
Fox mat speikea
d- decmal [Link]

SO4r
(apital1
Cayibln c23
tCopiel
IEEE 54 Stondayd - foy how foat 1s oyed in DATE
memog.
Fundamentals ot (0Mpte
(D3 per -p
- p.K,Sin
sinda

Bse Oreaatox
dcts ol
bea7b 4 but a

c-ax, 2 muSt be

neqative should not be float


b should not be 4

Case ot Ôutput
uorks t> hodiferen(e°n
it
) But in case of input Cscanf)
pdatF
differenH
input as decimal.
d dlways intexpYets on +S format
based
|)detma 1 i+
terprets
t
nput
dosen+ Start Lith 0 or OX_

ctol {+ Stats wt 0
Ox oy 0X.
0x
heXadeiimal if it stax+s wjtth
i) bo
reads decimaliguto-detes
onl
/leoaed
ardat2acd
1lnsaln
scanf(i n) /^/r:0ad s ic(her!

intoym of bitS
How numbens axe Stoxed
they aYe stoYed using 2s
Compliment

Shp0te oun inbinan


S
(pentall 122 216
esult
Ea-5
Add
in.
o
222
a? DATE
tcharacterS Stored as
as the qre foternally
integer S.

Hou t-conea 0egaive oumbers i binan0dal


hexadecimal ete ?
-witthout bit youCant represen
Steps-1Deide the bit width
xed two's comple ment Jalue
binan(Post+ue)
Conent eum tn
Complement (at
40dd 1)
Take the tuo'
4up bits into
heKadecimal
4- bit chunks -

3-bit chunks - otal


iato
128 64 32 1G

+
in binary

ginhex
3 c-18indctal
ou deices |ike Pc Simaxtphones display accYate
?
date 4 time een it he axe pawe red off
|Even hen the Systfm is otf, kw loc powex ciYcuit

axe sill running One ot them is BTC (Real Time

clock)hi
A smal chip on motherbaaYd inteqrated înto the main

oessSox Gnphone)

f
yussConHnuousy-using
ioteanet is available then
sounn
as Syncs it
paea.
or precise

aclurac

Pendtse where did my aBs go !


4'Shecduse hou)Storageis measredl
deices calculate it & space resenved tox foxmthng
JManutaLtuyers use demal (base (o)
mented

,
/A
shoy+ hand /combined ASsignment

* ," /,t -, A,<<, >


DAT

eratoyS.
+)--,

ComputYs use aa base 9)


So 16 aß beomes l4. 9

3-Precedenie
28-8 4 Associatyity
1S-{o %t 6+ 3/2
S - 2t 6 * 3/2 12"&+4-3+ 9Y.-5.
2+4-3*9 %-5
2+)4- 2 "o -S
39
22
[Link] table

|fnt a ,b2,cs26
at b S

at =LS aa g+S= 20
whe modifiedmore th an 2 thmes in
yaiable
aSiagle Statment hen
is

beaviour :sundehncl s
i alue chang Complex Lompiler o
Scanned d-executd
pratf stactee is

-29-8-2 po Modheys:hoxtlongsiqncdunsgnedloglodg
charcteas. min ma min max
-)28 o +12 to 25S
Signed
1-21 o 2 sMnsiancd
oianedchar ch= 120L-12G
Ugsigned chache 120 130
-uneioed chn ch>-l1l0
only one typ e moditiev tan be 4pplie in a statement,
A-Z! 65:90 DAE
SSD, S
Sol id state dive 248 25
stnetr)
hits
2shoxt intcl +
stdtot.h- hos fo+-tiotl6t,inta2-t,
pexiculax bits.
o stoxe inteaexs of that
short int na 13 -3,
//ahtSincaf(-b4e
I ight

shoyt ns 2 laght shot 1n :a bdeauli


it&-t n-b cnt (n)-161lc
4edef iat fM
s ooll -
-0Phona
go-8oAríay
dutatyp narne [size |1
X 2e
t-e Empt
oukle)
Real constant Lfioat

+ C1 subs cmpt LAtay indexin


6y detaul+ all am4
operatoY
0re COnstont pontn in Datic

int anLs1;
eB\35)ooGB bound
l00 3 looL4 looR 12 0G
1000
2J- 3S:
nalHcHon
nt ao[s- 10.20 30,0So tiSt

Ini4atlers
nt ass 110 20301:
30
2
Revo
he iohaliation list of has less iaitiallizetu

than siz e then glmalain indies stor e the detault


Nalue ot its data-type MA
on the
n pegendin4
inthali2ahonlist
LCompules he size
[Link] ioitallizers

topilea-automaticall
gven cmay
of amay avoi kasle
Ara nome by detau+ holds boseaddyers.
k1. Pintf add /u",ar);
C" DATE

o/p: loo o0 (02 fo 3o 82s


51ht a[s-{1,1), ,S,/1alaasl4nl
'~t aY [1c {S,b3i
Desianate ntalizaton
int am ls]lo,[3] = So, o

3
lo
22 33

f sie ofontayis
is not
no Knoun but dataty pe is
Knaun tta to yet siz emr to iHeaate amay H
lend sizeoF (an).
Si2e (or detaty}e)
etint an [ {1o,20aoY: int lens Sizeot(ann/size
for (io: is &ieoflen; +)
phef(-or .d]- yd \n' :a:):

Anain C should be atollectian ot simila


He element.

0p l33S&.65
toxc izoiS; ++i)
poatf ('and1= d ni, anli);
c¢ ctt axe not stictly yped languages.
Revetse iot
oa(f-5-1;io--)
iedt ('d"am Cin):
MAX Nnt i iat max0 Ant max 20nLal,i

aanl-)1(anEimax)
maxaani] max2amil;
|308 2S

Jwap az atb
iithout baa- b
36

bihise 0pertox
AP o
tuo integers using
to Suap
1o 2
Ans -22-1d3d 20 -

e @Ill-30

|o1O020
y 0lo-o

*nSu+th
body ae
Stateceat Onl
exeiuted
- 0|O
Hhe
- 20
Statements case

Swirtch Lch) O/pielcome


pontt C Hello"; llnsk he exeruked
Case1 printf welome");
brcaky

bpenatoY evaluoates leh +o mqht

+ [Link]-R
Rangcd case labels / Ranged suitch case
eiot chalo13
bwitch Lih)
FouY
alai

Case O printfU Singleln


SPate Sfate xtak
Cose l0 99: prntf(" Tuwo\n')
breakj
Fos mot Specitie for double
DATE
Scanf
Printf
+, f, e (scienthe
nohon)
.1f-+toea
doyble value

(ase L00 993 piatt l Threen

Case o00, 9999 pnatt C Foux \n;


btakj
detauitpaatfC Moxc tthan foux digits"D

divex S and what aye theiyfuncions


A
hot ay
aYe
duey saSpecialied piele Sottware that ats_ o
las a bidge between the os
a
and haxduware devites.
wihout driyexs the 0s wouldnt Koow how
to
Communiatewith haxdwaye.
The
Egwhen
e
Sometines alled as_ device dvers
we plug in pòntea 0s , needs a pnatta dbivex
translate its (ommands (ike print this page)int

Signals he pånteas understands.


Functions ot dyiveS
lommunication bndae. Translate os iostyueions 'to
into Os

haxdwaYe commands, & wice veLSa


Abstxaction - Allow Qs to use hardware
2)Harduaxe
usithot Knouing its technical details.

Resourse Management- Allo cate ¢ contol system


esouxces
4yEmx Handling - dee t & xepoxt device ereYí to Os

Owhy char in jova takes 2 bytes ?


aSauses Untcode not ASCIl.
-1 by4is enough to stoxe Ascl characteas but it
s Limited to eaglish Jedteas, digits 4 aymhali
Nntcode suppoxts many lanuages and symbals.
Vaicode, 0TE-|6 encadin epresents charatens as.
l6 bi+s.0 bytes) Aloaing java to stoxe. chaxattes
hommany langu49eShin di, [Link] ete
Syntax Pantt: int padt Sin1
(ongt Chay
,..)
+ is a Vai qble-lenyh

etuyns0 0x int
(pp
hy maino
Mafncmust retrK {ot bcz
in
4Vel dnex Shaty

3 Ho the 0s.
Sutcessnon-Zem eoay /talure
Yeturn 0

ou dont uxte it inmoden-(t

tlue&stdiah
lecludekmathks
Ant main

nt+ l"Fnter iceannumLen"l,


Scandl"d &numl;
-enp num,
while Lnumo)
digit num lo

(- 2)
do not exist")
breod

un: hun /lo.


numiadcmf
while Cnum zo)
d4dun l0

numaQum o
DATE

11925

Omhy do we declave a pointes vaiahle uith the datatype


Lof
+s the niahie it is pontia to when ?t wil
anyway StoY
stox e the addyess of that vanable ?
CAdhess willneves be float o7 chor ox doukle ete)

You might also like