//递归函数,调用自身
#include<stdio.h>
int fibFunc(int n)
{
if(n== || n==){
return ;
}else{
return fibFunc(n-)+fibFunc(n-);
}
} int main(){
int n=fibFunc();
printf("n=%d\n",n);
}
#include<stdio.h>
void Function(){
printf("%s",__func__);
}
int main(){
Function();
}
#include<stdio.h>
void Function(){
static int i=;//静态局部变量定义
printf("i=%d\n",i++);
}
int main(){
int j=;
for (j=;j<;j++){
Function();
}
}
int main(){
const int x=;//使变量只读
// x=2;
printf("%d\n",x); }
#include<stdio.h>
int main(){
int *p;
int a=;
p=&a;
*p=NULL;
printf("p=%p\n",p);
printf("*p=%d\n",*p);
printf("&a=%p\n",&a);
printf("a=%d\n",a);
void *p1=&a;
* int(*)p1=; }
i nt c=;
//int const *p4;
//const int *p4; //const在指针的左边,可以改变指针的指向,不可以改变指针的值;
//int *const p4; //const在指针的右边,不可以改变指针的指向,可以改变指针的值;
//const int *const p4;//特殊具有两个const,使指向和值都为只读;
p4=&c;
//*p4=20; int arry[]={,,,,,,,,,};
int *p1=&arry[];
int *p2=&arry[] ;
long number=p2-p1;
printf("number=%d\n",number);
int x=;
int *p=&x;
printf("*p=%p\n",*p);
printf("*p+1=%p\n",*p+); //指针运算 }
#include<stdio.h>
int main(){
/*
struct People liupeng ;
liupeng.age=18;
//printf("%d\n",Pepole.numer);
strcpy(liupeng.name,"liupeng");
printf("%s\n",liupeng.name);
//printf("%d\n",liupeng.age);
*/ //结构体
/*
struct Pepole{
int id;
char name;
char sex;
double age;
};
struct Pepole x;
x.id=18;
x.name='lp';
printf("x.id=%d\n",x.id);
*/ //使用结构体变量访问结构体元素
struct Pepole{
int age;
char name;
};
struct Pepole* p;
struct Pepole x={,"lp"};
p=&x;
printf("p->name=%s\n",p->name);
//p->id
}
#include<stdio.h>
struct People {
int age;
char* name;
};
union libray{
char name;
int id;
};
enum ABCColor {
Red,
Blue,
White
};
int main(){
enum ABCColor myColor; //枚举型
myColor=Red;
myColor=Blue;
myColor=White;
printf("myColor=%d\n",myColor);
struct People* p;
struct People x={,"lp"};
p=&x;
printf("p->name=%s\n",p->name); //使用结构体指针访问成员
printf("p->age=%d\n",p->age);
printf("x.name=%s\n",x.name); //使用结构体变量访问成员
union libray y; //联合体
y.name="poem";
printf("y.name=%s\n",y.name); }
#ifndef SeqList_h //用户自定义库文件
#define SeqList_h #include<stdio.h> struct SeqList{
int dataArray[];
int nLength;
};
typedef int dataType; #endif
#include<stdio.h>
#include "SeqList.h"
int main(){
dataType myAge=18;
printf("myAge=%d\n",myAge);
return 0;
}