58083programming c class notes
TRANSCRIPT
-
7/25/2019 58083Programming C Class Notes
1/4
Programming C
M S Prasad , UAA 105
C is a programming language designed for system programmers
, and device drivers and application program exiility! "#e
exiility of data de$nition , pointers % directly accessing t#e
memory & ma'es it easier to design a complex program !
A computer program operates on data % variale& and produces
t#e result!
Variable ( data ) types.
a! (nteger ) (nteger are *#ole numers represented as 1+ it
contagious memory in t#e computer! "#e integer could e
signed or unsigned also!
(nt var1 , var - ./ #ere var 1 and var are t*o variales
*#ic# #as een de$ned as integer! /."o represent a #ig#er integer values t#an 1+ it , it is
de$ned as long int % ma'es it it &A numer t#at is too large for an integer is automatically
converted to long !(t is read as )scanf% 2d& and printed as printf% 2d&! some more
representations are elo* )
data type 3ead% scanf%&
Print% printf%& 0
s#ort 2#d 2dlong 2ld 2ldUnsigned int 2u 2u
-
7/25/2019 58083Programming C Class Notes
2/4
4exadecimal 2x 2xctal 2o 2o
! 6loating numers % oat ! long doule , doule & "#esevariales are decimal numer representations t#ey are
represented as sign it , exponent and fraction part! "#e
oat representation re7uires it storage and provides
around 8 signi$cant digits!Most of t#e compilers do arit#metic operations in doule
precision only!% y default all oat declaration are doule&!scanf%2f& , printf%2f&
9xample 1
./ compute example area of circle /.
:include ;stdio!#+main%&
? doule radius , area -
printf% @ enter 3adius ) & - scanf%2lfB,radius& -area D pi/radius/radius -printf% area in oating numer ) 2fEn , area&-printf% area in exp notation ) 2eEn, area&-return 0-F
9xample
./ rate of interest tale /.: include ;stdio!#