在上面的一篇文章中写道了C语言的数据类型,而这篇文章则主要写int类型的介绍和int类型的主要使用方法。很多人都知道,int是一个整数型,可正,可负,就是不能是含有小数点,而ISOC也规定了int取值范围为-32768~32768。
(一)声明int与初始化
声明int共有两种声明的方法,如下案例:
初始化的共有四种,如下案例:
在上图的初始化过程中,可以看出,int values是初始化没有赋值,相当于创建内存空间,而后面的三个例子中,例如int test = 1;这个不但是赋值,还是创建了内存空间。
(二)int输出
上面介绍成功介绍int,下文就开始写int是如何打印输出,请看下文案例。
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SQUARES 64
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
/*
//文本的读取
char buf[MAX_LINE];
FILE *fp;
int