代码改变世界

Class,strict sizeof用法

2022-11-13 15:26 by 钟铧若岩, 14 阅读, 0 推荐, 收藏, 编辑
摘要:1 #include "iostream" 2 using namespace std; 3 4 class A{}; 5 class A2{char d,e;}; 6 struct B{}; 7 struct C{char b,c;}; 8 struct D{int x,y;}; 9 10 int 阅读全文

Size of的用法

2022-11-13 15:10 by 钟铧若岩, 53 阅读, 0 推荐, 收藏, 编辑
摘要:1 #include <cstdlib> 2 #include <iostream> 3 #include <iterator> 4 #include "string.h" 5 using namespace std; 6 struct{ 7 short a1; 8 short a2; 9 shor 阅读全文

const的作用

2022-11-13 12:04 by 钟铧若岩, 38 阅读, 0 推荐, 收藏, 编辑
摘要:1)定义const常量 2)const可以修饰函数的参数和返回值, 甚至函数定义体,被const修饰的东西都受到强制保护,可以预防意外的变动,能提高程序的健壮性 阅读全文

指针常量、常量指针

2022-11-13 11:57 by 钟铧若岩, 37 阅读, 0 推荐, 收藏, 编辑
摘要:1 #include <stdio.h> 2 #include <string.h> 3 4 int main(int argc, char **argv) { 5 printf("Hello, World!\n"); 6 7 int a = 10; 8 int a1 = 20; 9 //不能再修改 阅读全文

字符串函数以及宏定义

2022-11-13 11:41 by 钟铧若岩, 44 阅读, 0 推荐, 收藏, 编辑
摘要:最小值、以及平方的宏定义实现,注意()的使用 1 #include <stdio.h> 2 #include <string.h> 3 4 #define MIN(a,b) (a)<(b)?(a):(b) 5 #define SQRT(a) (a)*(a) 6 7 int main(int argc 阅读全文

在main函数执行完后,再执行其他方法

2022-11-13 11:24 by 钟铧若岩, 40 阅读, 0 推荐, 收藏, 编辑
摘要:方法如下: 1 #include <stdio.h> 2 3 int atexit(void(*function)(void)); 4 void fn1(void), fn2(void); 5 6 int main(int argc, char **argv) { 7 printf("Hello, 阅读全文

两个数字交换的方法

2022-11-12 23:48 by 钟铧若岩, 24 阅读, 0 推荐, 收藏, 编辑
摘要:http://t.csdn.cn/yQZSj 阅读全文

C语言数据类型转型没有搞明白的点。

2022-11-12 23:33 by 钟铧若岩, 16 阅读, 0 推荐, 收藏, 编辑
摘要:程序员面试宝典第30页,请专家指导下,感谢! 1 #include <stdio.h> 2 #define product(x) ((x)*(x)) 3 int main(int argc, char **argv) { 4 printf("Hello, World!\n"); 5 6 unsign 阅读全文

运算符优先级

2022-11-12 23:14 by 钟铧若岩, 26 阅读, 0 推荐, 收藏, 编辑
摘要:1 #include <stdio.h> 2 #define product(x) ((x)*(x)) 3 int main(int argc, char **argv) { 4 printf("Hello, World!\n"); 5 6 int a = 5; 7 int b = 3; 8 int 阅读全文

I++与++I 面试题

2022-11-12 23:08 by 钟铧若岩, 24 阅读, 0 推荐, 收藏, 编辑
摘要:程序员面试宝典第28页,书中的答案是9,49 而正确的答案应该是,12,42 3*4 = 12 6*7 = 42 1 #include <stdio.h> 2 #define product(x) ((x)*(x)) 3 int main(int argc, char **argv) { 4 pri 阅读全文