输出任何一个一维数组的内容# include //f函数可以输出任何一个一维数组的内容void f(int * pArr, int len){ int i; for (i=0; i<len; ++i) printf("%d ", *(pArr+i) ); //*pArr...
分类:
其他好文 时间:
2014-07-07 21:07:53
阅读次数:
101
在android下面debug,最主要的方式就是用logcat抓log了,我们可能有尝试过使用printf来打印,当然结果是不行的,这里有时间就看了一下android平台下log的flow,在此做个笔记以作记录
我们一般使用ALOGD来打印log,所以这里就跟一下ALOGD的flow
system/core/include/log/log.h
system/core/include/...
分类:
移动开发 时间:
2014-06-27 08:32:39
阅读次数:
548
1 #include 2 #include 3 int main() 4 { 5 int a,b; a=b=2; //成功 6 //int a = b = 2;失败 7 printf("%d %d",a,b); 8...
分类:
其他好文 时间:
2014-06-27 00:58:50
阅读次数:
187
(1)第一个作用:隐藏。
当我们同时编译多个文件时,所有未加static前缀的全局变量和函数都具有全局可见性。为理解这句话,我举例来说明。我们要同时编译两个源文件,一个是a.c,另一个是main.c。
下面是a.c的内容
#include增加这条语句
char a = ‘A‘; // global variable
void msg()
{
printf("Hello\n");
}...
分类:
其他好文 时间:
2014-06-26 12:15:11
阅读次数:
177
写这篇原创文章是因为看到了极客中的一篇文章《有趣各种编程语言实现2+2=5》,其中C语言是这样实现的:
int main() {
char __func_version__[] = “5″; // For source control
char b[]=”2″, a=2;
printf(“%d + %s = %s\n”, a, b, a+b);
return 0;
}
有些童鞋可能会说...
分类:
编程语言 时间:
2014-06-26 11:03:19
阅读次数:
282
接受用户输入的三个整数,作为三角形的三条边,并判断此三角形的类型。#include#includeint main(void){ int a; int b; int c; printf("please input a:"); scanf("%d", &a); pr...
分类:
其他好文 时间:
2014-06-25 17:36:48
阅读次数:
138
#include#includeint main(void){ char str[100]; char des[100]; printf("input a string:"); gets(str); int i = 0; int j = 0; int bla...
分类:
其他好文 时间:
2014-06-25 17:36:11
阅读次数:
163
程序清单6.5 compflt.c是比较浮点数是否相等的例子。原程序如下:// cmpflt.c -- 浮点数比较#include #include int main(void){ const double ANSWER = 3.14159; double response; printf("Wha...
分类:
其他好文 时间:
2014-06-25 15:58:30
阅读次数:
273
attribute method:
#include
struct packed
{
char a;
int b;
} __attribute__((packed));
struct not_packed
{
char a;
int b;
};
int main(void)
{
printf("Packed: %zu\n", sizeof(...
分类:
其他好文 时间:
2014-06-25 07:29:49
阅读次数:
155
转:http://blog.csdn.net/masikkk/article/details/5634886在将各种类型的数据构造成字符串时,sprintf 的强大功能很少会让你失望。由于sprintf 跟printf 在用法上几乎一样,只是打印的目的地不同而已,前者打印到字符串中,后者则直接在命令...
分类:
编程语言 时间:
2014-06-25 00:47:36
阅读次数:
248