c语言基础——01

static的作用:
1、限制作用域

2、延长寿命周期

3、私有化函数


const的作用
1、const修饰的变量不允许被修改


extern的作用:
1、申明变量或者函数已经在别的地方定义


register的作用:
把数据存到寄存器


volatile的作用:
被volatile修饰的变量,每次取值都从内存中取最新的值


基础算法
1、穷举法

2、递归求解
有递归结束条件;自己调用自己;

#include<stdio.h>

int jiecheng(int n){
	if(n==0)
		return 1;
	return n * jiecheng(n-1);
}

void main(){
int n,res;
scanf("%d",&n);

res=jiecheng(n);

printf("%d\n",res);
}

猜你喜欢

转载自blog.csdn.net/ithongchou/article/details/83019032
今日推荐