C:读取Windows操作系统的环境变量;
#include <stdlib.h>
#include <stdio.h>
int main(void){
char *pathvar;
pathvar = getenv("PATH");
printf("pathvar=%s",pathvar);
return 0;
}
#include <stdlib.h>
#include <stdio.h>
int main(void){
char *pathvar;
pathvar = getenv("PATH");
printf("pathvar=%s",pathvar);
return 0;
}
#include <stdio.h>
int main(){
int a=1,b;
printf("a=%dn",a);
b=a;
printf("b=%dn",b);
printf("&a=%dn",&a);
printf("&b=%dn",&b);
return 0;
}
#include <stdio.h>
int main(){
struct Student{
int num;
char name[10];
float score;
}
stu1={1001,"zhangsan",89},
stu2={1002,"lisi",96};
printf("%dt%st%.2fn",stu1.num,stu1.name,stu1.name,stu1.score);
printf("%dt%stt%.2fn",stu2.num,stu2.name,stu2.name,stu2.score);
return 0;
}
主函数:
#include <stdio.h>
int max(int x,int y);
int main() {
int a,b;
scanf("%d%d",&a,&b);
printf("%dn",max(a,b));
return 0;
}
max函数:
#include <stdio.h>
int max(int x,int y) {
return (x > y) ? x : y;
}
#include <cstdio>
#include <cstring>
int main(){
int a3[3];
memset(a,0,sizeof(a));
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
for(int k=0;k<3;k++){
printf("%dt",ai[k]);
}
}
}
return 0;
}