分享点资源(代码、技术点)
想赚点下载分,分享如下:
http://download.csdn.net/detail/qixing1115/9651643
http://download.csdn.net/detail/qixing1115/9651661
第一个里边有两段代码,怎么看。
第二个资源里点是一些知识,对C语言不是特别精通的人可以参考下,希望能给大家带来些帮助,第二个里边的主要有6个小测试,大家可以看看每一个都输出什么:
/*
* test_1 :玩转内存
* test_2 :玩宏时注意事项
* test_3 :和test_1差不多,玩转内存
* test_4 :删除当前指针,两次输出为啥不同?
* test_5 and test_5_1: (1)和(2)不行,(3)可以,为啥
* test_6 :简单内存移动,(1)和(2)有啥不同
*/
这里在这里只分享两个:
void test_1()
{
char idx;
u32 n = 0x03020100;
char w[8] = "abcdefg";
idx = n;
w[++idx] = idx + '0';
w[++idx] = --idx - 1;
printf("%d\n", idx);
printf("%c\n", w[idx]);
printf("%s\n", w + idx);
}
char *test_5(char *buf)
{
char buf1[32] = "abcdefg";
//char *str = "abcdefg"; //(1)
//char *str = buf1; //(2)
char *str = buf; //(3)
return str;
}
void test_5_1()
{
char buf[32] = "abcdefg";
char *a = test_5(buf);
a[0] = '1';
printf("%s\n", a);
}
都是些比较基本的东西,如果一眼能看出结果的大牛就不要浪费积分了