home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / CH_11 / 628.jpg < prev    next >
Joint Photographic Experts Group Image  |  2013-12-20  |  584KB  |  2550x3300
Labels: book | daybook | poster | reckoner
OCR: 628 Chapter C Library and Preprocessor Facilities Example 11-7 malloc.c malloc the Synopsis of di Accepts isplays bl lank input each sepa Qf word arated line of woras text, in the separates line, and each Objective TC illustrate use of the malloc funct on Incl .ude Files inci ude <stdio h> #incl lude <stdl ib h> #incl Lude <string h> Note I Cons tant Definiti .ons #define BUF SIZE512 int main( void char ins tri ing BUF SIZE], *currentpl *endword, *word; printf( printf( "Enter words line of separated text with blanks: \n" "with inst fgets ing[ instring, BUF instring SIZE, stdin "0' strlen currentpl instri ing; while endword strchr( cur rentpl, NULI Note *endword Note word strcpy nt word, char read that currentpl malloc strlen( n" curren word tpl Note pri currentp endword+ free void word Not ...