You can tap to write the following practice code, to see the results of the operation, are very simple, the key to understand.
If
# include <stdio.h>int main (void) {int i = 1;i = i + 1;if (i>10); i = 1;printf ("%d\n", I); return 0;}
If Example 2:
# include <stdio.h>int main (void) {int i;if (1 > 2) printf ("Haha! \ n "), else if (2 > 5) printf (" Hey! \ n "), else if (2 > 2) printf (" SKDF "), Else i = 1 > 2;printf (" i =%d ", i); return 0;} /* Summary: Even if multiple expressions are true, only the first expression will be executed */
scanf Example 1:
# include <stdio.h>int main (void) {int I, J, k;//printf ("Input: Value of I"), scanf ("%d%d", &i, &j, &k);p rintf ( "I =%d\nj =%d\nk =%d\n", I, J, K); return 0;}
scanf Example 2:
# include <stdio.h>int main (void) {int I;char ch;printf ("Enter value for I: i="), scanf ("%d", &i);p rintf ("result is: i=%d\n", i) while ((Ch=getchar ()) = ' \ n ') continue;int j;printf ("Please enter the value of J: j="), scanf ("%d", &j);p rintf ("Result: j=%d\n", j); return 0;}
Storage of floating-point numbers:
# include <stdio.h>int main (void) {float x = 66.6;printf ("x =%f\n", x); return 0;}
BOOL Variable:
# include <stdio.h>int main (void) {bool I;i = true;//1 is true, 0 is false. printf ("%d\n", I); return 0;}
Fetch address character &:
# include <stdio.h>int main (void) {Double i = 12314;printf ("% #X \ n", &i); Outputs the address of the variable i in 16 binary form return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Introduction to C Programming--Program practice (ON)