SYSC 2006 Chapter 2: CHAP 2(How to think like a computer scientist)

63 views5 pages

Document Summary

%i is a placeholder that tells printf() command to print an integer value. For strings, the placeholder used is %s or %c which signifies that the output is a character value. A character value is a letter or digit that is enclosed in single quote. (cid:862)5(cid:863) is a string (cid:858)5(cid:859) is a character. When you create a new variable, you have to declare what type it is. This variable can then store only that (cid:858)type(cid:859) of values. This type of statement is called declaration. char fred; It is necessary to put variable declarations before any other statements because c89 standard allows variable declaration only at the beginning of a block of a code. Once variables are declared we store values in them by using assignment statement. Variables can be represented on paper by using state diagram. We draw a box with name of the variable outside and the value stored is written inside the box.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents