91学习

陪伴你每一天!

一维数组与指针

#include <stdio.h>int main(){ int *p,*q,a[5],b[5],i; p=&a[0]; q=b; printf("please input array a:\n"); for(i=0;i<5;i++) scanf("%d",&a[i]); printf("please input array b:\n"); for(i=0;i<5;i++) scanf(&

内部函数static

#include <stdio.h>static char* GetString(char* pString){ return pString;}static void ShowString(char* pString){ printf("%s\n",pString);}int main(){ char* pMyString; pMyString=GetString("Hello MingRi!"); ShowString(pMyString)

指针的自增

#include <stdio.h>void main(){ int i; int *p; printf("please input the number:\n"); scanf("%d",&i); p=&i; printf("the result1 is:%d\n",p); p++; printf("the result2 is :%d\n",p);}

计算几次能渡河,*&的使用

#include <stdio.h>int main(){ int a=6/(3-1)+1; int *p; p=&a; printf("至少%d次能全部渡河\n",*&a); return 0;}

输出i,j,c的地址

#include <stdio.h>int main(){ long i,j,c; long *p,*q,*n; printf("please input tye number:\n"); scanf("%ld,%ld",&i,&j); c=i+j; p=&i; q=&j; n=&c; printf("%ld\n",&*p); printf("%ld\n",

输出变量的地址

#include <stdio.h>int main(){ int a; int *ipointer1; printf("请输入数据:\n"); scanf("%d",&a); ipointer1=&a; printf("转化为十六进制为:%x\n",*ipointer1); return 0;}指针是地址,指针变量就是一个存放地址的变量。

函数的嵌套调用

#include <stdio.h>void CEO();void Manager();void AssistantManager();void Clerk();int main(){ CEO(); return 0;}void CEO(){ printf("CEO给经理安排任务\n"); Manager();}void Manager(){ printf("经理给副经理安排任务\n"); AssistantManager();}void As

判断体温是否正常

#include <stdio.h>void judgeTemperature(int temperature);int getTemperature();int main(){ judgeTemperature(getTemperature()); return 0;}int getTemperature(){ int temperature; printf("please input a temperature:\n"); scanf("%d&quo

编写函数,实现R=U/I输出

#include <stdio.h>void oumu(float num1,float num2);int main(){ oumu(5,10); return 0;}void oumu(float num1,float num2){ float iTempResult; iTempResult=num1/num2; printf("电阻值是%f\n",iTempResult);}

使用语句函数,输出一则

#include <stdio.h>void Display(){ printf("三人行,必有我师焉,择其善者而从之,其不善者而改之\n");}int main(){ Display(); return 0;}