study c(vc中测试过)——基本变量,宏定义

#include "stdafx.h"
#include <stdio.h>

extern void main_fileoper22();
int main(int argv,char* arg[]){
 //命令行参数
 while(argv-->0){
  printf("%d=%s/n",argv,*arg++);
 }


 printf("start main....../n");
 main_fileoper22();


 return 0;
}

 

 

 

#include "stdafx.h"
#include <stdio.h>
#include <math.h>

/*数据类型长度,字符变量*/
int main_size()
{
 int a = 0;
 short b = 1;
 short int c = 2;
 int size = sizeof(a);
 int size2 = sizeof(b);
 printf("%d,%d/n",size,size2);

 
 char ch1 = getchar();
 putchar(ch1);

 scanf("%d",&a);
 printf("---%ld---",a);


 return 0;
}

 

 

#include "stdafx.h"
#include <stdio.h>
#include <math.h>

/*数据类型,输入输出*/
double globalvar;
int main_basicvar(){
 float a,b,c;
 double s,area;
 printf("%f,%f",a,globalvar);
 scanf("%f %f %f",&a,&b,&c);
 s = (a+b+c)/2.0;
 area = sqrt(s*(s-a)*(s-b)*(s-c));
 printf("%f",area);
 return 0;
}

 

#include "stdafx.h"
#include <math.h>

#define SQUARE x*x*x
#if !defined(SQUARE)
#define SQUARE x*x
#else
#define SQUARE x*x*x*x
#endif

#define ARRAY char*
typedef char* ARRAY2;

/*预处理:宏定义,类型定义,文件包含,条件编译*/
int main_define(){
 int x = 2;
 printf("start....../n");
 int a = 2*SQUARE;
 printf("%d/n",a);

 ARRAY array1,array2;
 array1 = "ssss";
 array2='d';
 ARRAY2 array11,array22;
 array11="wwww1";
 array22="wwww2";
 puts(array11);puts(array22);
 return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值