Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

In pre', iou chapters we·v looked ,It the C library piec am all- Itbi, ehapt sr fo _ use 00 rh '

libran f' a whole t, ,, __ .tion 2 l. t li :t, ~. neral guideline f rusin 1 the library- 1_ also de cribes a tri k ound in < -nl'e hbrar hi die ! u' in I~bill, '. ' a

- un ,. D. Seetir n .~ 1.2 ~iv 'c all. overview caleb be" der in th

:'1~3 d . _ the same fr the' n - , h' aders in Lbe ' c' Ii ~ ".

Later chapters ICOrVel" me Iibran ." header. in de'ptb" with related headers reaped til, ether into chi P' I. The -eat ddef he- anr <stdbool.h> h ' d r are 'Very bri f, '- I'v cho ,-0 to dJ cuss them in lhi chapter (in )ectiQ<D~ 2 .4 and 21.~ .. re pecti ely),

The ICS,I: ' tandard li brary 'I dlvJd d into 15 pac Ui~_ ith each part d' I, rib d b - a .1 head r.' 99 h ' .. an " dditl anal nine head ,_T . for a to . J of 24 I see Table ..... I . .1 J.

Table 21,,1 Standard - jbl1U' Hie d,

- -

<;inttypes . 'h> t <: sOI64'6.Mt <limits ~ h> <lolca,l'e,~ 11:> <math .. h:>

<B -tj rnp ,. b:>

<signal.h~ <:stdar'g ~,~

-'"

<s"tdbooll " h>'

<:8 ddez .lb <:8' d,int .. h> t <s'tdi,C) "h,:)

<: 'stdl.ib . h~1 -e st.r Lng , b,:> <tgma,th.h,>, ·<:time ~ h>

,<.a.ssert ,. he-<;complex~h>1" <C!t.ype~h>

- "'"

<w'cbarlO ho-

<:.wc.typ'e . h:>

- =0 - t compilers am with - mre ~ tensive Iibrery that invariably ba mmny head -I too don't P! iear in Tab), 2t.l The e II headers _ ren 't land d of

OOUI<-', . W,~, can't count en them to be available wi h other compilers, These

header that ,_" . p i 1[_ 011 a particular comput -r r >per,,_ ingsystem Iwhlch e plains vh I 'ey-reo.ol,c,tandard.,.' hev ma provide unetions that allow ·mO[1· control oi _,,-, the screen and keyboard. Hader that upport graphics or a winduw-,b sed us ' interfa -'e e 1",. ,0' -, on.

The srandard headen consist primarily of func in proto pes lype de initioa and macro definitiens. If ODie of our d,e. I~ mtams t call : f . I f-unction deel red ill, II header or u ,_' ,0111, of 1:h . types or macro' defined there, WI -,-' II nee t in Iud ~ the header a th, beginning of the file. When a file' ! - eludes sever .1 stand-rid headers, tb order of #lncl ude dlr ctive doe ,8. I, ms tter, I ~, also Iegal to 'n': Iud ~ ~ tan,d -rd head r m re than once,

, I lestrlctlens on ',i ame ': Us, d II n ,he Llhrary

Any file tb:-:l in,clu_ [_5 tand rd header must '" ey couple of rules. irst it can't use the names of macros defined ~[. that b ader ror any ,Qtb'r purpose. If ,I til includes ,<st,dio[ @ h,-,*, ~o_ example it can t reuse NULL!! ince a maero ey thar name it, Iready defined in <std.io" ' ~. S'BC"od, library n -, with file seep (typ[edef name .. in parti .ular) can t be redefined at the 61 I· el, ThU[, if. iiI includes <8 d i.o .. h':>~1 i can' t define s i.ze t ,'~ '" .-0 · rer with fih .:

_....

<stdio .. h,;)- d fine siz,~_t_· be '~ypedef name,

. Jth ugh the : _ ,Ile' 'bill -tion . are pr n~. '. b i· u' '" . ha ': ·'Itbr-re~tricti .' lS, that '[u might not expect:

• Ide'nrtijie'rs ,tfi-a',t ,begi',1 - -it .. ' tin u.lI.deTt~f:oreJo',II(JI, -ed by a"llp/I',flr.[ctu'fllen,··,. fJIlF [a Sl"co'l:J1d underscore are re .'-TV d r use within the librs ;'. ;0 P(fl gram . hould never U" mames of this form f I[ any purpo se ..

- Id",,,,,/i'ers that lJ,egin'w'itlz [a',l ll,rile'r, C'Q are r served ro us e as identifier and tag~ with file '. cope.You should never use ,u,ch a Dame for your O'WB purposes unles it's declared inside '., function.

I. . very ith'R[tifi.:er w,"'t" [exte,r','G'lliRkager in thl' standard li_'"1Jrrrtry ,"~I • re .... erved for use as an identifier with external linkage, In ",articll,I '1'; the names of all, tandard Iibrary functions ar re ~ rv ed, Th'11'. '. ven if 8. file' doesn't in,~ lude <:,stdio'" h)'il it shouldn 1 defim an external -UD til o· named p>:rintf~ljnce there -, '_ lready a function with tbi name in the library,

These rule 'ppl.y _10 e er flle in a program, r gardl ~-s f wbi h head rs the file include ," Although the e rules aren't aLW y:, ~ n( II ed, faillns to I' be' them can lead ItO[ H program tht '- nc t p rtabk -."

The rules listed ahov lapp!y no' Ju" to n that an: currentl [_ ed in th

library, but ,8.1.0 to names Lbat are' ,r et aide or future use. The, omplete de 1Cl~ ption ot which names, are reserved i·, lath .. Iengthy: you'll find it in the C ,t311d::' d under futun library direc 'in ,.' -, ;' " an example C r eserves iden [t"~e " that begin with

8, t r followed 1, at lower -case letter su that function'; , ,irth such name [can b ' added to the <string ",h'~ header,

lfs common ~:tJr C programmer I~O replace small functions ~y parameterized mac ... res, This. practiee oeenr even in the ~u;andard Iibrary, The C standard allows head ...

1111 ens '[01 define macros thathave the same names as library fU11CtiODS. but protect tbe programmer by requiring that a true function be available M, well.A . a result it". not unusual for • tih~rary header to declare a function and define :31 IDIICflO with the same name,

We've already' Steen an example of a macro duplicating '1 library function. geteh,ar is a lib,rary function declared in the <st,dio .' h:'> header .. t bas, tile fQ[ .... lowing prototype:

int getahar (vD·.id) ,;

'<::.s·Cdi,o .' h>, usual 1,)1" define ge:tc'.h.ar ~., n maeroa well: #de f in,e gietchar {) get. e ( EI'tdin,l

By de,fault a c,aJl of g,at'char will be 'rreated. 8, a macro invocation (since macro names arc replaced during preproees: ing),

Most of tbe time, we're happy using ,I macro ill tend, of a true function, beC,BUQ1e it will prob"abIDy make our program run faster, 'O'c',casionaiIDy though, we want a genuin _: function, perhaps 'to .nll, i n i mize tile' size flf the' executable code.

If the need arises we can remove II macro definition (thus g,Wnin,g ,ilCCCS,S to #undef dtr,ectIV9" r4.~' the true function) by using the #undef directive, For example we could undefine the 'gle t chax macro after Including <: s,t dio " h>:

#include <stdio.h> :#undef g'8'tchar

If g@tc,har isn't a maCFO no harm ha .. been ,done; #unde,f has no ,tfffect w en given a D,aD]8 that is not deft ned as, a, macro.

As ,an alternatlve we can disable individual uses of a macro b:y putting parentheses around i ts "name:

The pfepIOCeS~UJI" C.fU:( t spot a parameterized macro unless its Dame i . followed 'by a left parenthesis, ne compiler isn't SOl CI' ·ily fooled", however; mt can ~t~]~. recognize .g,e.tJ:=hJi'r :15 It function.

We'll now ' e ,8 quick look at the h~ader inthe iC8~9 tandard library .. This section can serve as a "(road map" 'to help you determine which part of the llib'raty you

- -

need. Each header is described io de£aiID Jate,r in tbi chapter or 'in a subs quent

chapter,

,~aSse17t .h~ headerJlo-24.1 Contain onl the assert nl3r rei, which . llows u· to in 'eft self-checks into a pro.' ram. If any he k fail \I th, pn gram It· rminate .' .'

ec vpe.b~ header.23.,5 Pro id ..... functio -I for classif ins charact n and or onverting 11,'_[ from lower to upper ease or vice vets .,

~e:trn·o. h;.o ItHrtad~r .,2lJ:;2 PJE ",'1 _ errno r(' err' r ~_U mber") an I alu .that c n I e te' 'td let' a call 01 1.1 T'lain libr .' function to see if aD error occurr d during the call I

11 I~ h'

< _1m11~S '. :>

cmath.h>

«math. h:> header .... 23.,3

<se jmp .h~ header'P24.4

Pro ider mal ms that de scribe tile characteristics 0 floating types, including their range and accui ac· .

Provide macros that describe til _ eharac ri- tics of integer _ pe:~ including character tyPICS) including their maximum land minimum values,

Pro ide'. function 0 h elp a. program adapt in beh vior 0 a counu .r otl er g: 0,... graphic region, Local -specific behavior include the ·Ia· numbers I:' printed (such as, the character used as the d. cimal P0i11t), (be format o monetary values (the curr ncy symbol for ~ ample), the nara te r set.. d the, 'p-arance 0 the date and time.

Provides common mathematical flU1CIJOn'. '0, inr Iuding tngc nom e tril byp rbolic exponential loganrhmic power neare ,It intezerr abselu e alue, and 1'",1:, lin er function I.

INonloca/lJumps

Provide: the set.jmp and longj mp functions, setj,mp mark -II~ II pl ce in a pfl .~ gram; Lonqj mp can then be used ' 0 return t . th t pl ,ce late. The, e functions

21 ~2' rC89 Library Overview 53'3

TIUlk_:_ it po· '. ible [0 jump -rOl01 1l,E; function into another, till-ac ~ e fun tion, . ypa in~ the normal fun" tion-r 'urn m 'ell.' ism, set j' mp 'and Lonqj mp ar ~

U';' d prinlaril for han. '; : .senous It blem lb' . ~ '_ during progn m ex _ cution,

I 1 h cS,1gna: .,->

<sigal.~ head ,,"',2t13 unctk I, that deal with I, ',_" ptional c nditi n I I ".j. nal .j, including in r-

rupts and run-time rrors, The signal uneti n installs a Iun tion to be . alJd if a given signal .. bould occur later. The r'ai se function, au es ,3 signa] to I:CCur ..

<: stdarg . h> l1eader ~2G.1' Prov ide t '. IIIJ i _~or itin 0' functi: ' I" h~ r" , print an: s canf C': n ha aria I!:.' number I' '. rguments,

<;st,di,Q t h~ headew "'22. '~,8rO'vid,~ a large I •. ' J ntrnem 0' input/eutp tt un tion .. includin - . p erations on b 111 , -,qunti. 1 and random-a c _" tiles,

:S dlih .h~ heade,1f .,26.2 ' ~ tchall' hea ' r for functi U· 11_ l don't fi int I IDIJ'th '- otter header i The

function in thi beadier can conv rr . trings _0 numbers aenerate p eudo-random numbers, perform memor management task I communi at_' with the operating ystern, do searehing and sorth g, and erform _0Il} CTSt ms b I, ~. n multibyt characters "n· - " ide I chara _ fer ..

~string .h::t heada, ~2-3'.6- Provides functionsthar nerforrn s tring oper tions, including .'". p in ." concatena = Li JL compar i on and searching as well 3 fUIIl' i . ns til ,t opera e on art itrary - lock, of mem{lry.

< t ime . h> Date an'd Time

fun Li 11 r ne 't rminlns the Urn and dar . , 01,' nt -utlin time I ,an,,·

_ lit '., fOI~ displa .

Some 0'- th bit,g_sl'hang,e' inc_9 affect th . t· nda ~ .. ' library. hese ch n e all into three groups;

• Additial .llllfl(lI1',~' .. The I, ',.,.' 'land rd library has nine headers that dODI t lexi t

in C g", Three .f the' (<:isQIJ6,o 6 .. h:> <wcba·r i h» and <wlctype h.s) W er actuall added 'to C in 1995 'whien the C··gl ._ t ndard -" - amended. hie ·th·r ix «-complex!l h», « f env .. h>._ <:inttypes. h», <:stdbool,~ h », <s,tdint ~ h>,lnd ~tlgmatl"l. h» - e n w in I' "'.

• .' -cj ~ i:tloftlll macro ' fl- ,; p."t:',tiO'dS. The C99 " tandsrd '.: dd n18-'. TO, . nd fUDCtions .o several . oj' in helle- p imarilyef Loat; I. h», emat.h ~ h>,., mod <=stdio .. h», Th additions I' tb <rna 1'1 .. } > h ader 'e ' exte "it that they're IC, vered in a separat -', iection SeCUIOD .23~4).

II Ii,' ~itl.'ll'cetl ,6,f"rio_, S' Iqf II· ;-;, ,Rllg /';'"'Cti:tJR,'cW' Some " j' ting fULDC .' ,n, , including printf and aoanf ~ ha e dditionru cnpabiliries 10 C'9i9.

We Il nc I-~ take a quick look at, the ni ne ad . tiona! he ad .[, in he '·99 _. tan ' rd library, just as we did n11 SI_ '[ion 21.2 for the be,ad ~ r in the 'C8'9 library.

Die fine '. the comp Lex and I m'd ro I which are U,' -u) wh '11 w' rkin -- ith cornpie' Dumber'. AJ .' ". pr vi c:,'I'S Iunetio . Jar performing mathematical operation', 1 n compl x numbers.

-eEenv , h~ l1eadBr""21.t;

Provide - ac ess to floatlns -p lint I tatus flag'.' and co-ntr-ol modes. ort , a

program might res a flag to see if CJ : rfl I. I urred during :3: floatins -p ih t opera-

don or . er a ·ontr 1 mode to specify bow fOUOI m,~ . bould b don'.

cinctypes ,~h~ neader ",21~2 Defin -'~ macros that can be UJ d in r rnu 1 lri ng for mpltuloutpuit of the "n'~ ger typo declared in <stdin.'t ~h>. Ala provides functicus f r orkmg with greate.' t-width integers,

c'iso646 . h:> Alternative Spellin9~~

<iso646, b_~ head'er .25L3 "Define ma rc that r pre, ent c min Dip rato . (th ,n es c ntaining the haraeter

&~, I" ..... , I., and A). Thesemacrosare useful for writing programs in an nviroam ent

wh· '~, the e I haracter mi. 11: not be part I ~ f the l '~d CIVlJl8·· er set,

C'W' o ,I ,typ' 'e h- '"

- _, I, .. , .' . • _I: ,.

Defines the bool, t rue. and fal Be macros, as well as, a macro that can be used to test wbetber Ihesemacro have been defined,

Declares integer t"fP'es with specified widths and define' related macros (sueh as macros that specifythe maximum and minimum value of each Iype)., Ah;, , define parameterized 1l1aCrOS that construct Ioteger constants w lrh specific 'types.

In C'99~ there are multiple ver ion' of -momy math functiom in the -ema t h ., h:> and! ~ comp1 ex I. h,~ headers, The "type-generic" macros in ,~tgma.t'h ., 'n:> can detect the 'typa~ ofthe arguments pa' sled to them and substitute a call of the appropriate <math .. ,h~ 'Dr <,co'mplex "h> function.

'The wide .. character version of wectype ~ h:>. Pmvides functions nor' classifying and changing the' case of wide characters,

The ,<,sltd,d1ef .. h~ header provides definitions 0 - frequently g, ,ed typ IS and maeros; it doesn't declare any functions, 'The types are:

• pt.rdi f f_t,. The type of" be result when two pointers are subtracted, I. size_t,. The type returned 'by the s.i:z,eo,'f opiI'r,fI[Or,

.~'char_t,. A type large enough to represent all possible characters in, all sup-

ported locales,

All three are names for integer types,; pt,rdiff_t must be a signed type, while size_t: must be 'an unsigned type, ' lor more information about wChaT_t, see Section 25.2"

The <s,tddef ~ h» header also defines two macro,'. Dine of them i NULL~ which represents the null pointer, The other macro, lo,ffs@t,(ll.f~ re uires two arguJDe11ts,: 'Ji/"e (a structure type) and member-designator (a, member of the structure).

536 Chapter ,21' The Stan',da,rd ,Library

offastof'm mtes m 'numb I b, te

and the specific _ memb T .

. onsider the ollo . ~ " ,,·tru, nun ,:

struct s { char a; int b(2)i r flea C I.

) ;'

Th 'alu, 0 offs,e' of (stru(:1t 81 a) must 1- o:~ C ruarantees hat tb first

m nb r fa tru - lb atnle ddr .. 'h I . Ul- i ,'. L ~ " ':_ ... _J ,~' ft r

. r hat the offse is til, l,of-tsletof I( struct

a , b) i" l Tsincea I~ ne byte Iong) n - 01 fs,el of(stru~t 8, c) ~. 9 I., ssumin - _,2-bir inter ev I'~ H '" " ["'m, G mpil rs I ,tt I, "hole .. '~un ,I, byte -in . truetures « ee, the Q. 'eclhlD at the lend of Chs er I I),~ hich can aft _ It til -, alue pre u ce b-' of f aet.of. I' ac mpiler sh uld leai I three-l yt hole . '[ a, . r exarrn Ie tt n rh ,ft1·,_ . of b ar d C '01 be , . md I., r _p: . ,;om tively, B,UtL that's the beaut 0 off,setof: i[ produ >, th .correct offset ,I lan'

o il £, enabling us 1.,1 ". i· rtable rt ,gr,aJTI'·.,

Thr i JU~ us '. fer offsstlof. -,or,~ :_ In-I .sup e that Ie, nt to

S .v, the -, "11 'two member of an S I trueture in a tl~ '. ignoring the c membe .

i Iuaetlen »zes nstead ofha jn'[T the fwri te functir D rit s iaeof (struc _ s) b t . ~ which

would sr lb, emirestruc e ' "II ell il t ,I writ, on1 Q,ffseto£ (stru'ct S II

e'l byte.

Innl ernark: , JOIn' _f I h co t P- all' mar "I defined i,n e at.ddef ~ h»

apl . -. in alb r headers . ' It 'TI NULL mac. - lr - ~ i - a] 10 defin -d in

<loc,ale,.,l1.>" <stdio th:>~ c:stdlib.h';>. ,'-".:string"h>'I and <,ti'm,e"h> '111 31n in ,,',_9' he ner ,<wcharlh>~,. _' re mlt, -e- progranu ned Ito include c:,stddef JI h»,

-1115 The c:,-,tciboal. ,h> el,-- ,d~ (I~_,., 1)1: Boolean Ty"pe an _ Value~1

• bool (d fined [ole _Bool)

II true • fal SI8 (I e lned to be 01'

• booL true fal,sle ar'@ ~def ned t( . fin d tc be 1

W: . ve se n man exampl - . o ,- hoi boo L, t rue, an - falSie ,. 'r ised, PDr nti 1 iu f til, - bo,ol' rue -,alee are de ined ~- _ re re more llmlr d, A

- ~

pro ran roulc U~I" a prepr . IDio direc i e . U ;c. il ,r '1 Lf de -). res

macr ,I bef r attempting define its own_ ersion of bcso 1 true" 1(' fa,lse.

Q&A

Q6

Q: I -_I til'~". th .1:' 1..8 U e the erm 'itan,dard heade .~I fl,-belr' than I_I. Ib'nd' rd

b:_sd'. r 1iI-~ Is ther anv rea 00 for not g. in,-' '_b. . r' "til' ?

.. -

A: . es, , ... cording to the t standard. a 'standard header" ne d mot n file, .', th llcb

0.10,' _ compile d rn~ ed to_ dard headers d files" the h', a - r . uld in act

b, built into th " compiler its el f~

Q,:,·ection 141,t!] d,' erl bed som' ,disad. Wlt'i'- M,e 0'. uli _,', - p, . 'am,' terizd maer -- in

place I I· run. ~. ,101 .. 106gb. 0 . til .' , pf'ub,l, -'ID :50 t it dane -'_: 1" to pro id ,ft

1113 ~,ro .llu:bstitnt fo:1 a standard Ubra_ , ' f'Unction,",1 [p, ~ 1

A,: icording ,0 the C standard ,3 aramet rized rnacrc lh'~ 'l mb li utes for a library

function mu It b 1""f:uU'" protected" . par 1l1'1'! -,- and must e /aluate its argume

e actly once. These rules avnid most of the orobl 01·' mentioned '~n S,' tion 1 3.

~ '. locate where header -- - are kpl on ., our '., ," . 'IIL Find the nonst ' tdard headee land d lermine [he 'purpo', (1 f eaeh,

2. Having located the head r file' on your Y~~' m ~:' . L rcl e I. find -rand- rr b ader ill which a. macro bides a, function.

I~ •• hen' lL1UICfl ihides ,t function, whi lih U I "'11 llil t iln tb header fit : lb_:' m _ ro d __ ini-

ti on OJ'" thelu nco L 1 (~'n prototype? J LI '. tit), )'QIW· an wer,

4. Make a U·[ 1 U rese c, idenliner. in We "future library direcnons" ecti n . f m.h _99r ~laod~lrd i Distin zuish between identifiers that (Ire r _ erved ror use' on ~ y when a specific h_'1 ~del i· included ersu identifiers lb.~U are . I rved f F' use as e lemal names,

*,5. The i slowler functlon, whi ·'h belongs te cctype", 1'1>'1 tests whether u character i'. a

lower ... ca e Ieue r.Wb~ ,. ould lh~ 'oll . in' mac v t· lin r- isloll/er not be ~ gal,

t eeording 1: I the standard? (_ Il.1 mijl~ assume lh, 1 I I ch rae er I et il A en. I

,defin'@: LaLowe.r (c' ((c) ~= II a I! k& (,e), <= ~ z II)

61, The (;'ct'Yl?f! ,. h~ header USUtlll~ de tine .. most it . funutin as m eli a, well, These macros rely on a 'mic ,ma.y that's declared in <:ctype ,.n, btu lefined ill OJ, separate DIe. A ponlon cf :[1 t 'pile, 1 <ctype. h> head r ppe~r bel I '. e ILhi ample to Q r rhe I 1- lowing questions.

( ,.1 '. h do tne names c f the "~bit' rnacr (sueh 3. _UP PER I iU d the _ c type ana h sin

with an unde cure',

ttl) EX,~l] in \' hal tile ~C" yp'e~ array will contain. Assuming Ilba,~ the character set is AS,Cll;o

~ how the . alues of th . array ~1 smen I , t P ition 9 I th h rizon j ~ l- I. haracrerj, I the

ipaee character), 65 (the letter ,A).. and ~4 t the A character]. Set'! :ec'tion. 23,,) for 8! d .,~ "ription f "hat each macro should return,

c) Wbal',- the advnnL ge of 'U ' ins

If define UPPER OxOl

#defl.n,e LOWER Ox02

#dE::fine D'IG I T IOXO ,-

#definle CQNTRO'L OxOB

--

,;f4d,le - Lne l?UNCT Ox 0

.1'lde'i,.£! SPACE Ox20

Ide i- ine HEX Ox40

#d,efine SLA:NK OxB'D

n I IT,~y m" im lemen the e moe cro ~,l} I up'per~IC se letter I '* lower-case l~tter ,I I decimal digit *1

/ * cantro,l c'harac::,t'er * I

1* punct.uaz Lon ehazact er *1 1* wl:ll. 2 space ohazac _ @r '* I I" hexadecdma.I Idigit I

I 'It space cha.racuez 'it I

#de,fin@ isalnum(cl #de'fine is,alp,ha If c) #define iBcntrl'(~)

I,define isdig-"' t; (le')1

#lde f Lne i 199raph ( c )

( C ype [aJ & (_OPPER _LIOIWERI~DIGIT) ) (=ctyp1e [0] & (_"OPPER ~LOWRR) )1

(_c:typ~ I[e] &: CI,ONTROLl

(_ct:ype' ~c] &: O'IGITJI

( Ict~e [aJ &;

- (,_PUNiC I = UPPgR 11_ OWER I_DIGIT) I( C' -ype [Ie] ~ LOWER)

- -- -

( c'type tel &.

'(_BLANKI_PUNCT I UP'PER I_LOWER ~_DIG- 'T) )1 (_'c"'~'ype [C:] k _PUNCT)

( c ype lcl & S,PACE)I

( ctype Ic) & OPPER)

- - ....,.,_

(~ct'ype [[c] &, "_DIGIT ~ .HEX,) ,

is,lower (,c) ;'e ine iaprin't ee)

define ispunct(c)l

: def' ne i.aspace (e)1

" clef ine i suppler I( "~)I #derfinle isx:digit {c)

1'., J n ,- hich ,1' ndard header l I U, ynu~ ~ p I [I " find each of [be f UI ,ilng.

(a) . 11e ' urren da" Oi til ,"~',u "_'IF

b) ,', fun ctlo th t te t I wb tiler a eharacte i _ di it

(c) macro that aive the larges 't UDS' i gned int 11D_

d , ., i n : '1, ~untl I' n atir g-p ,iot Dum, r t lh_- next hi,' "b· r in eg,

(e) macro that I p lfies tl ." number ,f bits in a, character

I( I mac~o that . -c ,I ift " he nunl -, r ,'- ,il nifi - L di! it ln _ double 'I U

I!L b

I ,~ "'rit·- pr gr 1,- h I' I:," L~' -'~ the a struct see j '_ ell n ,_;] .4 ' ,an I print , ze" and " ' ... se ': IOf the a~ b, am d c members, (Ui' C B i zeof t! find i, iz ',,' I~ use of f s,e ~ of' ~o find o' -

I, ve the pl!l!!J""m prin th ' size I' th Ie tir ' . ill tur 1_ ",I, - U From thi ,~ nmatlou

det ermme hether or n l 1 te srructure h I. b I·. Il ~l doe '_ de seri 1_ the locution and

size .' f each,

You might also like