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
| #include <stdio.h> | |
| int | |
| main(void){ | |
| char c = 1; | |
| printf("%d\n",sizeof(!c)); | |
| short s = s; | |
| printf("%d\n",sizeof(!s)); | |
| } |
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
| #include <stdio.h> | |
| #include <vector> | |
| int | |
| func(std::vector<int>::iterator &p){ | |
| return (&*p == NULL? 1:2); | |
| } |
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
| #include <stdio.h> | |
| int | |
| main(void){ | |
| bool t = true; | |
| printf("%d\n",t << 1); //=> 2 | |
| printf("%d\n",++t); //=> 1 | |
| printf("%d\n",t); //=> 1 | |
| int i = 1; | |
| printf("%d\n",i << 1); //=> 2 | |
| printf("%d\n",++i); //=> 2 |
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
| #include <iostream> | |
| int | |
| main(int argc, char ** argv){ | |
| (argc > 1? std::cout:std::cerr) << "Hello" << std::endl; | |
| } |
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
| #include <stdio.h> | |
| #include <string> | |
| #include <typeinfo> | |
| #include <cxxabi.h> | |
| struct Super{ | |
| virtual void hello(void){ | |
| printf("I am Super.\n"); | |
| } | |
| }; |
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
| #include <iostream> | |
| int | |
| main(void){ | |
| int a = 2, b = 1; | |
| auto x = (a > b? 2 : 1.0); | |
| std::cout << x << std::endl; // => 2 | |
| std::cout << sizeof(x) << std::endl; // => 8 | |
| } |
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
| #include <stdio.h> | |
| void func(int a){ | |
| printf("int %d\n",a); | |
| } | |
| void func(unsigned int a){ | |
| printf("unsigned int %d\n",a); | |
| } | |
| int | |
| main(void){ | |
| int a = 2, b = 1; |
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
| #include <stdio.h> | |
| struct Hoge{ | |
| Hoge(int a){ | |
| printf("int %d\n",a); | |
| } | |
| Hoge(double d){ | |
| printf("double %f\n",d); | |
| } | |
| }; | |
| int |
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
| #include <stdio.h> | |
| int | |
| main(void){ | |
| int a = 1, b = 2; | |
| int c[] = {4,5, (a>b? 1:2)}; | |
| int d[(a>b? 1:2)]; | |
| printf("%d\n",c[2]); // = > 2 | |
| printf("%d\n",sizeof(d)); // => 8 | |
| } |
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
| #include <stdio.h> | |
| const int N = 100000000; | |
| int | |
| main(void){ | |
| static int a[N] = {}; | |
| printf("%d\n",a[0]); | |
| } |