C中经典的helloworld程序
来源:互联网 发布:中华大字典软件 编辑:程序博客网 时间:2024/05/18 13:08
hello world 程序不同实现方法:
1. 利用宏定义
#include "stdio.h"
#define say(str) puts(#str)
int main()
{
return say(hello world!);
}
2. 教科书式写法
#include<stdio.h>
int main()
{
printf("hello world\n");
puts("hello world\n");
}
3.
#include <stdio.h>
int main()
{
return puts(&"Do not say: Hello world!"[12]);
}
4. 退出是运行自定义的退出函数
#include <stdio.h>
#include <stdlib.h>
void say()
{
printf("world!");
}
void sth()
{
printf("Hello ");
}
int main()
{
return atexit(say), atexit(sth);
}
hello world 程序在运行的生命周期经过:
预处理阶段:将头文件的内容插入程序,得到文本程序
编译阶段:编译阶段将上一步骤得到的文本程序通过编译器得到汇编语言程序
汇编阶段:将汇编语言翻译成机器语言指令,及hello.o目标程序,hello.o 是一个二进制文件
链接阶段:printf 有一个单独的文件pritnf.o 链接器将该文件链接到hello.o 程序中,生成可执行文件。
可见小小的helloword程序也大有学问啊!
0 0
- C中经典的helloworld程序
- 经典程序helloworld
- c#经典HelloWorld程序
- FlashLite 入门:经典HelloWorld程序!
- 超经典的 Java 入门之 HelloWorld 程序
- 超经典的 Java 入门之 HelloWorld 程序
- 黑莓开发学习(入门教程)03-经典的HelloWorld程序
- C程序HelloWorld
- 01-C#HelloWorld程序
- C语言中,计算程序执行时间的经典例子
- WordCount:Hadoop中MapReduce的HelloWorld程序
- 经典的C程序--1
- 绝对经典的C程序
- 在Java程序中调用C函数--打印"HelloWorld"
- 在Java程序中调用C函数--打印"HelloWorld"
- Eclipse搭建Scala入门经典程序Helloworld
- C++、CORBA版HelloWorld程序
- C++、CORBA版HelloWorld程序
- Javascript 中innerHTML和innerText的区别
- failed to create the java virtual machine
- spring 任务调度 Quartz 表达式
- Fzu 2160 Mountain climbing 模拟
- URLClassLoader使用方法和实例
- C中经典的helloworld程序
- open gl 相关网址
- C/C++日常学习总结(第六篇)多基派生引起的虚函数访问二义性问题&重载,覆盖,隐藏的区别
- 将特殊格式的NSSring转换成NSDate
- Device Tree常用方法解析
- 在Android中自定义捕获Application全局异常,可以替换掉系统的强制退出对话框
- android 将图片内容解析成字节数组,将字节数组转换为Ima ...
- Levinux,解决在非linux系统下在linux环境中使用和学习python问题
- Emacs (坑)