我的C学习过程(C primer plus)
一,基础知识
//稍微介绍了C是怎么回事,怎么流畅的写一个“Hello Wrold!”
1.编程步骤
定义目标->设计目标->编写代码->编译程序->运行/调试程序->维护与修改
2.编程机制
(编译器) (链接器)
源代码————>目标代码————>可执行代码
3.C程序的基本框架
#include<stdio.h>//
int main (int argc,char *argv[])
{
printf("Hello wrold!");
return 0;
}
4.多函数
</pre><pre name="code" class="cpp">#include<stdio.h>
void buttfer (void);
int main (int argc,char *argv[])
{
......
}
void buttfer (void)
{
......
}
5.调试
二,中级知识
//学完这些只是入了门,现在可以解决稍难的问题了
1.数据类型
类型修饰符 | 基本数据类型符 |
long | int |
short | float |
signed | double |
unsigned | char |
2.格式化输入/输出
printf();
scanf();
3. 运算符/表达式
+ , - , * , / , * , & , | , ! , ~ , ^
什么是表达式?像这样:a=b+c
4.流程控制语句
while(条件) (为避免遗漏更新) for(初始化;测试;更新) ; (保证循环至少做一次) do
语句 ; ——————————> 语句; ————————————> 语句;
while(条件);
5.函数
int f(int n);//整型返回值,传入整型参数
int main(int argc,char *argv[])
{
......
}
int f(int n)
{
......
}
6.数组与指针
数组:int point1[10];
char point[5]={'H','e','l','l','o'};
指针:int *arry;
char *arry2;
(指针有六种操作)
7.字符串操作
字符串函数:输入 输出
gets(name); puts(name);
fgets(name,max,stdin) fput(name,stdout);
scanf(); printf();
还有strlen(); strcat(); strcom(); strcmp(); strncnp();
8.内存操作
五种存储类:
auto 代码块内 覆盖外部定义,重申
register 代码块内 存取更快
extern 函数外 引用声明,引用别的文件中的定义
static 函数外 外部链接变为内部链接
static 代码块 动态变为动态
动态分配内存:malloc(); 与 free();
9.位操作
按位与: &
按位或: |
按位异或:^
取反: ~
左/右移: << , >>
三,终极知识
1.C预处理器/C库函数
2. 高级数据
对于C预处理和C库我没深入了解,感兴趣的自己去研究吧!
高级数据应该就是计算机专业的《数据结构》,讲的是组织数据的方法,算法是她的实现方式,目前正在学习中。