渥瑞达 Linux Unix下C语言软件开发视频教程 笔记3
来源:互联网 发布:动态表单数据库设计 编辑:程序博客网 时间:2024/06/04 18:06
Chapter 1 Getting Started
1.ASIMPLE EXAMPLE
This program prints out the message “Thisis a C program”
Example1:
#include <stdio.h>
int main()
{
printf( "This is a C Program\n" );
return 0;
}
Every C program contains a function calledmain , This is the start point of the program.
#include<stdio.h> allows the programto interact with the screen, keyboard and file system of your computer. Youwill find it at the beginning of almost every C program.
Main() declares the start of the function. Whilethe two curly brackets show the start and finish of the function.
Printf(“This is a C program\n”)
Prints the words on the screen . The textto be printed is enclosed in double quotes, The \n at the end of the text tellsthe program to print a newline as part of the output.
C is case sensitive, that is, it recognizesa lower case letter and it’s upper case equivalent as being different.
Compilingin Linux
Gcc is the compiler from Gnu
$ gcc hello.c
$ gcc –o sample hello.c
The compilation will proceed silently, andmake an executable file called a.out
Runningin Linux
./a.out
Result:
This is a C program
2.Comments
Emample2:
#include <stdio.h>
int main()
{
int Counter=0; /* Initalise Counter */
/* a comment */
/*
*Another comment
*/
return 0;
}
A comment starts with a /*and ends with*/
Summary:
The basic structure of a one-functionprogram i:
#include <stdio.h>
/*************************************************
*...Heading comments...*
*************************************************/
/*Data declaractions*/
int main()
{
/*...Executable statements...*/
return 0;
}
- 渥瑞达 Linux Unix下C语言软件开发视频教程 笔记3
- 渥瑞达 Linux Unix下C语言软件开发视频教程 笔记1
- 渥瑞达 Linux Unix下C语言软件开发视频教程 笔记2
- 渥瑞达 Linux Unix下C语言软件开发视频教程 笔记4
- 转载 Unix/Linux下C语言学习指南
- Unix/Linux下C语言学习指南
- Unix和Linux下C语言学习指南
- Unix和Linux下C语言学习指南
- Unix/Linux下C/C++开发技术
- 详解C语言开发unix/Linux下安全套接字(SSL)的TCP服务端程序
- 详解C语言开发unix/Linux下安全套接字(SSL)的TCP服务端程序
- linux下C语言多线程开发学习笔记
- linux C语言开发 笔记
- Linux下C语言开发
- 整套Linux C开发视频教程
- 在Unix/Linux下防止二重启动(C语言)
- 新手Unix和Linux下C语言学习指南
- 在Unix/Linux下防止二重启动(C语言)
- jsp和存数据库编码问题
- fedora 14 启用root账户
- vim批量添加删除注释的方法
- Android下常用的图像处理程序(灰度化、线性灰度变化、二值化)
- 在CentOS上安装Git
- 渥瑞达 Linux Unix下C语言软件开发视频教程 笔记3
- 黑马程序员 网络编程
- 每天一个linux命令目录
- git的使用之三
- 动态链接库DLL创建和使用
- Data Modle:游戏对战模型
- hashCode()的作用
- J2EE中JSP页面引用外部资源时的路径问题
- protected成员在c++和java的区别