블로그 이미지
Leeway is... the freedom that someone has to take the action they want to or to change their plans.
maetel

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
  • total
  • today
  • yesterday

Category

Steve Oualline
Practical C Prgoramming
6. Decision and Control Statements


calculations, expressions, decision and control statements

control flow
linear programs
branching statements (cause one section of code to be executed or not executed, depending on a conditional clause)
looping statements (are used to repeat a section of code a number of times or until some condition occurs)


if Statement


if (condition)
    statement;

relational operator

"According to the C syntax rules, the else goes with the nearest if."


KISS principle (Keep It Simple, Stupid)
: We shoud write code as cleary and simply as possible.

"By adding an extra set of braces, we improve readability, understanding, and clarity."



strcmp
Compare two strings
: The function compare two strings, and then returns zero if they are equal or nonzero if they are different.
: This function starts comparing the first character of each string. If they are equal to each other, it continues with the following pairs until the characters differ or until a terminanting null-character is reached.
: Returns an integral value indicating the relationship between the strings: A zero value indicates that both strings are equal. A value greater than zero indicates that the first character that does not match has a greater value in str1 than in str2; And a value less than zero indicates the opposite.


Looping statements
while statement

while (condition)
    statement;

The program will repeatedly execute the statement inside the while until the condition becomes false (0).

the Fibonacci numbers    (피보나치 수, 한글 위키백과)


break statement
Loops can be exited at any point through the use of a break statement.


continue statement

"Programs should be clear and simple and should not hide anything."




'@GSMC > 서용덕: DMD Programming' 카테고리의 다른 글

[Steve Oualline] 7. Programming Process  (0) 2008.04.05
week 4 review  (0) 2008.03.27
week 3 review  (0) 2008.03.22
[Steve Oualline] 5. Arrays, Qualifiers, and Reading Numbers  (0) 2008.03.16
hw2  (0) 2008.03.15
posted by maetel