Amazon.com Widgets Chapter 13, page 306, getchar()
Welcome, Guest. Please login or register.
Did you miss your activation email?
July 22, 2014, 11:56:37 AM
Home Help Search chat Login Register 
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+ Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+ Old Stuff
| |-+ Chapter Study
| | |-+ Chapter 13 - Underlying C Language Features
| | | |-+ Chapter 13, page 306, getchar()
Pages: [1] Go Down
Print
Author Topic: Chapter 13, page 306, getchar() (Read 863 times)
beebauman
Newbie
*
Posts: 3


Email




on: December 19, 2010, 05:09:45 PM

For those who were confused by this line in the section explaining the null statement:

Code: (Objective-C)
while ( ( *text++ = getchar() ) != ' ' );
    ;

This is how you can get it to work:

Code: (Objective-C)
char inputTextArray[100];
char *text = inputTextArray;

while ( ( *text++ = getchar() ) != ' ' );
    ;

printf ("%s", inputTextArray);

Just type something into the console, include a space at the end, and hit enter.
Logged
Pages: [1] Go Up
Print
Jump to:



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.