BASIC STRUCTURE OFA C PROGRAM C程序的基本结构 Basie Structure of A C Program L Example 1-3: Hello World 在屏幕上打印一行文字。 L Program Comments(注释) /* Example 1-3(CWo1-03C) 口 Preprocessor directive(预 Print a line of text 处理命令) Thsi9 my first c program*/口 Function(函数) Statement(语句) include <stdio. h> 口 Return0;(返回语句) int main o printf ("Hello World! ")i return o Hello World 第一讲〔语言报疹计入门 目录
C程序的基本结构 Basic Structure of A C Program Example 1-3: Hello World – 在屏幕上打印一行文字。 Program BasiC sTruCTure oF a C Program 第一讲 C语言程序设计入门 目 录 Comments(注释) Preprocessor directive(预 处理命令) Function(函数) Statement(语句) Return 0;(返回语句) /* Example 1-3 (CW01-03.C) Print a line of text. This is my first c program.*/ #include <stdio.h> int main() { printf("Hello World!"); return 0; } Hello World!
BASIC STRUCTURE OFA C PROGRAM C程序的基本结构 Basic Structure of AC Program(Cont 1/5) / Example 1-3 (CWo1-03. C) P卫inta1 ine of text This is my first c program. * include <stdio. h> int main() printf("Ee1 Lo World!"国注释( Commen) 文本 return 0 不被执行 用来对程序进行描述 第一讲〔语言报疹计入门 目录
C程序的基本结构 Basic Structure of A C Program (Cont.1/5) BasiC sTruCTure oF a C Program 第一讲 C语言程序设计入门 目 录 /* Example 1-3 (CW01-03.C) Print a line of text. This is my first c program.*/ #include <stdio.h> int main() { printf("Hello World!"); return 0; } 注释(Comment) – /* 文本 */ – 不被执行 – 用来对程序进行描述
BASIC STRUCTURE OFA C PROGRAM C程序的基本结构 Basic Structure of AC Program(Cont. 2/5) / Example 1-3(CW01-03C) Print a line of text This is my first c program. * #include <stdio. h> int main() Pint("e110wor1国预处理命令( Preprocessor directive) return 0 告诉计算机包含某一文件的内容 < stdio. h>定义了标准输入输出操作 第一讲〔语言报疹计入门 目录
C程序的基本结构 Basic Structure of A C Program (Cont.2/5) BasiC sTruCTure oF a C Program 第一讲 C语言程序设计入门 目 录 /* Example 1-3 (CW01-03.C) Print a line of text. This is my first c program.*/ #include <stdio.h> int main() { printf("Hello World!"); return 0; } 预处理命令(Preprocessor directive) – 告诉计算机包含某一文件的内容 – <stdio.h> 定义了标准输入/输出操作
BASIC STRUCTURE OFA C PROGRAM C程序的基本结构 Basic Structure of AC Program(Cont.3/5) / Example 1-3(CW01-03C) Print a line of text This is my first c program. * include <stdio. h> 口函数( Function) int maino C程序包含一个或多个函数,其中必须有 printf("Hello World!")i 个main函数 圆括号( Parenthesis)指示一个函数 return O int表示man函数返回( return)一个 整数值( integer value) 【}( braces)包含函数体(body }( right brace)表示main函数结束 第一讲〔语言报疹计入门柔
C程序的基本结构 Basic Structure of A C Program (Cont.3/5) BasiC sTruCTure oF a C Program 第一讲 C语言程序设计入门 目 录 /* Example 1-3 (CW01-03.C) Print a line of text. This is my first c program.*/ #include <stdio.h> int main() { printf("Hello World!"); return 0; } 函数(Function) – C程序包含一个或多个函数,其中必须有 一个 main 函数 – 圆括号(Parenthesis)指示一个函数 – int 表示 main 函数返回(return)一个 整数值(integer value) – { } (braces)包含函数体(body) – }(right brace)表示 main 函数结束
BASIC STRUCTURE OFA C PROGRAM C程序的基本结构 Basic Structure of AC Program(Cont. 4/5) / Example 1-3(CW01-03C) Print a line of text This is my first c program. * include <stdio. h> int main() printf("Hello World!")i return 0 口语句( Statement) 行称为一条语句 必须以;( semicolon)结尾 命令计算机完成一个操作( action) 第一讲〔语言报疹计入门柔
C程序的基本结构 Basic Structure of A C Program (Cont.4/5) BasiC sTruCTure oF a C Program 第一讲 C语言程序设计入门 目 录 /* Example 1-3 (CW01-03.C) Print a line of text. This is my first c program.*/ #include <stdio.h> int main() { printf("Hello World!"); return 0; } 语句(Statement) – 一行称为一条语句 – 必须以 ; ( semicolon )结尾 – 命令计算机完成一个操作(action)