1 // typesize.c -- 输出类型的大小 2 #include 3 int main(void) 4 { 5 //C99为类型大小提供一个%zd说明符 6 7 printf("Type int has a size of %u bytes. \n", sizeof(...
分类:
其他好文 时间:
2014-06-28 23:13:47
阅读次数:
245
1显示程序执行的窗口一闪即逝。可以添加如下语句:getchar()作用是获取键盘输入。2 inf 和 nanfloat toobig = 3.4e38 * 100.0f; float not_a_number = asin(1.2);//math.h printf("%e \t %e\n",...
分类:
其他好文 时间:
2014-06-28 21:57:22
阅读次数:
305
int dis_data = 32769; if( dis_data > 0x7fff) dis_data -= 0xffff; printf(“%d\n”,dis_data); 上面的dis_data 输出值会是多少? 初一看可能还看不出来,那就计算一下: 0x7fff转换为十进制为 32767,...
分类:
其他好文 时间:
2014-06-21 13:29:14
阅读次数:
247
字符串格式化操作符(%)只适用于字符串类型,非常类似于C 语言里面的printf()函数的字符串格式化,甚至所用的符号都一样,都用百分号(%),并且支持所有printf()式的格式化操作。语法如下:format_string % string_to_convertformat_string为格...
分类:
编程语言 时间:
2014-06-21 10:07:07
阅读次数:
289
indexOf()方法,查找某字符串在一个字符串内的位置,没有则返回-1string aa="abcdef";int a=aa.indexOf("bc");//a会等于1int b=aa.indexOf("a");//b会等于0int c=aa.indexOf("g");c会等于-1所以你只要判断返...
分类:
其他好文 时间:
2014-06-20 15:14:51
阅读次数:
184
_cdecl和__stdcall都是函数调用规范(还有一个__fastcall),规定了参数出入栈的 顺序和方法,如果只用VC编程的话可以不用关心,但是要在C++和Pascal等其他语言通信的时候就要注意了,只有用相同的方法才能够调用成功.另外, 像printf这样接受可变个数参数的函数只有用cde...
分类:
其他好文 时间:
2014-06-20 13:55:03
阅读次数:
237
1. sizeof(literal-string) is number of bytes plus 1 (NULL is included), while strlen(literal-string) is number of bytes.2. Printf and scanf formatBefo...
分类:
其他好文 时间:
2014-06-18 10:14:22
阅读次数:
226
#import
//交换函数
void swap(int x, int y)
{
printf("x=%d,y=%d",x,y);
int temp = 0;
temp = x;
x = y;
y = temp;
printf("x=%d,y=%d",x,y);
}
//
void swap2(int *x , int *y)...
分类:
编程语言 时间:
2014-06-18 07:10:13
阅读次数:
302
把 c 编译成 arm 指令的可执行文件
/usr/bin/arm-linux-gnueabi-g++ hello.cpp
cat hello.cpp
#include
void crash(){
char *a=0;
*a=0;
}
int main()
{
printf("hello world\n");
crash();...
分类:
数据库 时间:
2014-06-18 06:50:45
阅读次数:
424
本文是笔者对printf的一种全新的尝试,自己发现了一些printf与众不同的功能...
分类:
其他好文 时间:
2014-06-18 00:59:35
阅读次数:
195