C有三个用于输出字符串的标准库函数puts()、fputs()和printf()。
1、puts()函数只需要给出字符串参数的地址。
#include
int puts(const char *s);
示例:
#include
#define DEF "I am libing"
int
main(int argc, char **argv)
{
char str1[30] =...
分类:
编程语言 时间:
2014-06-24 22:04:37
阅读次数:
368
嵌入式linux多进程编程
在主程序显示文本菜单,提供如下服务,要求每个服务都通过生成子进程来提供。
服务包括:日历信息显示,日期信息显示,判断闰年服务,文件复制功能,数字排序功能,退出功能。
#include
#include
#include
#include
#include
#include
void DisplayCalen();// 1 显示...
分类:
系统相关 时间:
2014-06-24 20:43:39
阅读次数:
302
C语言中宏的使用(#,##,do…while(0)宏)
1.预定义宏的使用__FILE__,__FUNCTION__,__LINE__。
#include
void fun(void)
{
char v1;
short v2;
int v3;
long v4;
printf("v1: %x\n",&v1);
printf("v2: %x\n",&v2);
print...
分类:
编程语言 时间:
2014-06-24 15:29:13
阅读次数:
214
在C中有时我们会使用goto语句用于执行跳转,但是不能跨越函数
#include
void func2()
{
int num = 0;
dst2:
if (num > 0)
{
printf("func1()\n");
func3();
}
if (num == 1)
return;
num++;
goto dst2;
}
void func3()
{
}
...
分类:
其他好文 时间:
2014-06-22 20:46:50
阅读次数:
144
以下的一段代码:
#include
greeting()
{
printf("Hello, world!\n");
}
main()
{
greeting();
}
经过gcc、ld(链接、编译)之后,生成一个elf可执行文件,再使用objdump处理,生成的反汇编代码如下:
08048368 :
8048368: 55 push %ebp
8048369: 89 e5 mov %esp,...
分类:
系统相关 时间:
2014-06-22 17:34:39
阅读次数:
351
是吗hello爱发起#include<stdio.h>
intmain()
{
printf("helloworld!");
}num=521
(1)sed加正则表达式
[[-n"`echo$num|sed‘s/[0-9]//g‘`"]]&&echo"Itisnumber"
(2)变量的子串替换+正则表达式
[[-z"`echo"${num//[0-9]/}"`"]]&&echo"Itisnumber"
(3)变量..
分类:
其他好文 时间:
2014-06-22 11:55:10
阅读次数:
191
一、文字常量区域
#include
int main()
{
char *p = "hello";
int i = 0;
for(i = 0;i<6;i++)
{
printf("%c",*(p+i));
}
*p = '1';
}
大家分析验证以上代码,p 是一个指针变量,存储地址,“hello”是一个字符串占6个字节,当我们用printf的时候能够输出"hello...
分类:
其他好文 时间:
2014-06-22 09:32:20
阅读次数:
200
这书不错,链接-装载-库 我觉得是很底层的东西。比如很多人闭着眼睛都能写出来的hello world(当然不包括brianfuck,如果你会,你真的闹残了吗= =), 其实链接编译器做了很多,不然就哪来的printf,这IO初始化也是CRT(c runtime)库完成的。堆栈的初始化,还有系统装载让程序运行等等。涉及很多。
书里后面就讲了一个CRT库,自己写一个,感觉不错,学了很多。比如mall...
分类:
其他好文 时间:
2014-06-22 06:46:27
阅读次数:
337
题目31:八进制转换为十进制
1.程序分析:
2.程序源代码:
main()
{ char *p,s[6];int n;
p=s;
gets(p);
n=0;
while(*(p)!='\0')
{n=n*8+*p-'0';
p++;}
printf("%d",n);
}
题目32:求0—7所能组成的奇数个数。
......
分类:
其他好文 时间:
2014-06-21 20:45:13
阅读次数:
150
#include
int printf(const char *format, ...);
int fprintf(FILE *stream, const char *format, ...);
int sprintf(char *str, const char *format, ...);
int snprintf(char *str, size_t size, const cha...
分类:
编程语言 时间:
2014-06-21 20:39:48
阅读次数:
215