Memory analysis of C language Variables C language addressing from large to small # include <stdio.h>
int main (int argc, const char * argv[]) {
int a = 100;
int b = 200;
printf ("The address of A is%d\n", &a);
printf ("The address of B is%d\n", &b);
return 0;
} out:
The address of A is 1606416268
The address of B is 1606416264
-"4 bytes apart, from large to waiter/three, scanf function This is a blocking function # include <stdio.h>
int main (int argc, const char * argv[]) {
int a = 0;
printf ("Please input a num:");
scanf ("%d", &a);
printf ("The NUM is%d\n", a);
return 0;
} #include <stdio.h>
int main (int argc, const char * argv[]) {
int A;
int b;
printf ("Please input the first number:\n");
scanf ("%d", &a);
printf ("Please input the second number:\n");
scanf ("%d", &b);
printf ("The result is%d\n", A + B);
return 0;
} #include <stdio.h>
int main (int argc, const char * argv[]) {
int A;
int b;
printf ("Please input the numbers:");
scanf ("%d%d", &a, &b);
printf ("The result is%d\n", A + B);
return 0;
Precedence brackets for arithmetic operator operators > positive and negative > Math operations > Bit operations > Math VS > Logic VS > Conditional Operations > Assignment Operations v. Assignment operator compound assignment operator + =-+ *=/= vi. self-increment self-reduction a++ ++aa--a PS: No squared: a** a//Seven, sizeof output accounted for the number of bytes eight, the relational operation except 0 is true the return value is only 0 and 1, true is 1, false is 0 There are multiple operators, you can use the results 1 and 0 continue in order of precedence operation nine, logical operation The results of the logical operations are only 1 and 0 logical with: && logic or: | | Bit with: & Bit or: | Bit or: ^ #include <stdio.h>
int main (int argc, const char * argv[]) {
int result = 1 ^ 1;
printf ("result =%d\n", result);
return 0;
} out:result = 0 logical non:! Any value is true and FALSE!!! 10 or three mesh operation Xx?xx:xx#include <stdio.h>
int main (int argc, const char * argv[]) {
int a = 10;
int B = 20;
int result = a>b?33:11;
printf ("result =%d\n", result);
return 0;
} out:
result = OneXi. if basic use 12, if use note variable scope 13, switch condition can only be int or char defined variable in case, must be included with {}, or there will be compilation error # include <stdio.h>
int main (int argc, const char * argv[]) {
int a = 10;
Switch (a) {
Case 10:
{
int B = A + 1;
Break
}
Default
Break
}
return 0;
}
C Language Review 1