Created
October 28, 2021 03:17
-
-
Save chaojian-zhang/0733c164341442dafe42feb3e83e4c36 to your computer and use it in GitHub Desktop.
Basic Lectures on C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int main() | |
| { | |
| int a = 5; | |
| int* b = &a; | |
| int c[] = {1, 2, 3, 4, 5}; | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int main() | |
| { | |
| short s = 5; // 2 | |
| short int si = 5; // 2 | |
| int i = 5; // 4 | |
| long l = 5; // 4; 5012 | |
| long int li = 5; // 5012-4=5008 | |
| long long ll = 5; | |
| long long int lli = 5; | |
| char c = 'a'; | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int main() | |
| { | |
| int a = 5; | |
| long long b = &a; | |
| int* c = &a; | |
| int d = *c; | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int main() | |
| { | |
| int a[] = {1, 2, 3, 4, 5}; // &, *, &c, &c[0], c+0, c[5], &c[5], c+5, *(c+5) | |
| int* b = a; | |
| int* c = &a; | |
| *(int*)(b+4); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment