12.05.2015 Views

type - David Vernon

type - David Vernon

type - David Vernon

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Types, Variables, and Assignments<br />

• >> doesn’t allow user-specification of input<br />

<strong>type</strong>s; use (C library function) scanf<br />

char ch = ‘A’; int i = 0;<br />

float f = 1.1; double ff = 3.14159;<br />

scanf(“%c %d %f %lf”, &ch, &i, &f, &ff);<br />

• The ampersand & is essential<br />

– It takes the address of the variable that follows<br />

– scanf expects only variables<br />

Copyright © 2007 <strong>David</strong> <strong>Vernon</strong> (www.vernon.eu)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!