Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
September 24, 2017, 06:49:22 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register Chat  
Pages: [1]   Go Down
  Print  
Author Topic: Chapter 13, page 306, getchar()  (Read 1654 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:  

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 ゥ 2009 classroomM.com. All rights reserved.