$B$6$6Cn%m%4(J


$B#C8@8lF~Lg(J
Introduction of The C Programming Language

$B"%#C8@8lL\


$B!!JQ?t$N;H$$J}$r3P$($k(J

$B!!JQ?t$H$O!"%W%m%0%i%`$N

/* * $BJQ?t$N;H$$J}$r3P$($k(J * / main() { /* $BJQ?t$N@k8@!!%W%m%0%i%`K\BN$N:G=i$K@k8@$7$^$9(J */ int seisu; /* $BJQ?t(J seisu $B$r@0?t$H$7$F@k8@$9$k(J */ float jissu = 2.2; /* $BJQ?t(J jissu $B$r<B?t$H$7$F@k8@$7!"CM(J 2.2 $B$rBeF~$7$F=i4|2=$9$k(J */ seisu = jissu; /* $BJQ?t(J seisu $B$K!"(Jjissu $B$NCM$rBeF~$9$k(J */ /* $BJQ?t(J seisu $B$O!"<B?t(J 2.2 $B$G$J$/!"@0?t(J 2 $B$,BeF~$5$l$k!#(J */ }

$B!|!!JQ?t$r@k8@$9$k(J
$B!Z=q<0![(J$B!!!!%G!<%?7?!!JQ?tL>(J;
$B!!!!!!!!!!!!(Jint answer;

$BI=(J2_1 $B%G!<%?$N
$B%G!<%?$N $B0UL#(J
$BJ8;z(J $B#1J8;z(J
$BJ8;zNs(J $B#0J8;z0\F0$NJ8;zNs(J
$B@0?t(J $B>.?tE@$r4^$^$J$$?tCM(J
$B.?tE@?t!K(J $B>.?tE@$r4^$s$@?tCM(J

$BI=(J2_2 $B%G!<%?$N7?(J
$B%G!<%?7?(J $B0UL#(J $BBg$-$5(J
char $BJ8;z(J 1
short $B@0?t(J 2
int $B@0?t(J 4
long $B@0?t(J 4 $B$^$?$O(J 8
float $B.?tE@?t!K(J 4
double $B 8
long double $B 8 $B$^$?$O(J 12

$BI=(J2_3 $BJQ?tL>$NIU$1J}(J
$B!|!!L>A0$N@hF,$OH>3Q1QJ8;z(J
$B!Z@5$7$$Nc![(J$B!!!!(Jint answer1;
$B!Z4V0c$C$?Nc![(J$B!!(Jint 1answer;
$B!|!!A43QJ8;z$O;HMQ$G$-$J$$(J
$B!|!!#C8@8l$NM=Ls8l$O;H$($J$$(J
auto break case char const continue default do
double else enum extern float for goto if
int long register return short signed sizeof static
struct switch typedef union unsigned void volatile while

$B!!F1$8

$B!!F1$8A0$GJ#?t$NCM$rF~$l$k$3$H$,$G$-$kJQ?t$,G[Ns$G$9!#(J $BNc$OJ8;zNs%G!<%?$HG[Ns%G!<%?$r07$&%W%m%0%i%`$G$9!#(J

/* * $BG[Ns$N;H$$J}$r3P$($k(J * / main() /* $B#C8@8l%W%m%0%i%`$N3+;O(J */ { /* $BG[Ns$N@k8@!!%W%m%0%i%`K\BN$N:G=i$K@k8@$7$^$9(J */ char msg[] = "Hello"; /* char $BJ8;zG[Ns(J msg[6] $B$N@k8@$H(J Hello $B$rBeF~$7$F=i4|2=(J */ int data[] = { 1, 2, 3, 4, 5 }; /* int $B@0?tG[Ns(J data[5] $B$N@k8@$HCM$rBeF~$7$F=i4|2=(J */ }

$B!|!!G[Ns$r@k8@$9$k(J
$B!Z=q<0![(J$B!!!!%G!<%?7?!!G[NsL>(J[$BMWAG?t(J];
$B!!!!!!!!!!!!(Jint data[5];

$B!|!!G[Ns$NCf?H$r;2>H$9$k(J
$B!Z=q<0![(J$B!!!!G[NsL>(J[$BE:;z!J%$%s%G%C%/%9!K(J]
$B!!!!!!!!!!!!(Jdata[4]
$BG[Ns$NE:;z$O(J 0 $B$+$i;O$^$k$N$G!"E:;z$N:G8e$O!"!V(J$BMWAG?t(J - 1$B!W$H$J$k(J

$BI=(J2_4 $BG[Ns$N@k8@$H=i4|2=$N;EJ}(J
$BJ8;zG[Ns(J
$B!|!!J8;zG[Ns$r@k8@$HF1;~$K=i4|2=$9$k(J
$B!!!!(Jchar msg[] = "Hello"; $B!!(J/* $BJ8;zG[Ns$N=i4|2=(J */







$B!|!!J8;zG[Ns$r@k8@$7!"=i4|2=$9$k(J
$B!!!!(Jchar msg[6];$B!!!!(J/* $BJ8;zG[Ns$N@k8@(J */
$B!!!!!!!!!!!!!!!!!!!!(J /* $BJ8;z$rBeF~(J */
$B!!!!(Jmsg[0] = 'H';
$B!!!!(Jmsg[1] = 'e';
$B!!!!(Jmsg[2] = 'l';
$B!!!!(Jmsg[3] = 'l';
$B!!!!(Jmsg[4] = 'o';
$B!!!!(Jmsg[5] = '\0';$B!!(J/* $BJ8;zNs$N:G8e$r<($9(J \0$B!J(JNULL $B%L%kJ8;z!K(J
$BG[Ns(J
$B!|!!G[Ns$r@k8@$HF1;~$K=i4|2=$9$k(J
$B!!!!(Jint data[] = {1, 2, 3, 4, 5}; /* $BG[Ns$N=i4|2=(J */






$B!|!!G[Ns$r@k8@$7!"=i4|2=$9$k(J
$B!!!!(Jint data[5];$B!!!!!!(J/* $BG[Ns$N@k8@(J */
$B!!!!!!!!!!!!!!!!!!!!(J /* $BCM$rBeF~(J */
$B!!!!(Jdata[0] = 1;
$B!!!!(Jdata[1] = 2;
$B!!!!(Jdata[2] = 3;
$B!!!!(Jdata[3] = 4;
$B!!!!(Jdata[4] = 5;

$B!!CM$NF~NO$H=PNO(J

$B!!$=$l$G$O!"0J2<$N(IX=D(J2.1$B$NDL$j$K%W%m%0%i%`$rF~NO!"J]B8!"%3%s%Q%$%k$7$F

(IX=D(J2.1 $B$"$J$?$N$3$H$r65$($F$/$@$5$$!!(J------------------------------------------------------- /* list_2-1.c */ #include <stdio.h> main() { char name[128]; /* char $BJ8;zG[NsJQ?t$N@k8@(J */ int toshi; /* int $B@0?tJQ?t$N@k8@(J */ float taiju; /* float $B<B?tJQ?t$N@k8@(J */ printf((IR$BL>A0!!G/Np!!BN=E$rF~NO$7$F$/$@$5$$!#(J\n(IS(J); scanf((IR(J%s(IS(J, name ); /* $BL>A0$rJ8;zNsF~NO$9$k(J */ scanf((IR(J%d(IS(J, &toshi ); /* $BG/Np$r@0?t$H$7$FF~NO$9$k(J */ scanf((IR(J%f(IS(J, &taiju ); /* $BBN=E$r<B?t$H$7$FF~NO$9$k(J */ printf((IR$BL>A0$O(J%s$B!"(J%d$B:M!"BN=E(J%5.1f kg$B$G$9!#(J\n(IS(J, name, toshi, taiju ); } /* $BL>A0!"G/Np!"BN=E$r=PNO!"BN=E$OA4It$G#5J8;z>.?tE@0J2<#17eI=<((J */

$B!|!!(Jprintf$B4X?t$N;H$$J}(J
$B!Z=q<0![(J$B!!!!(Jprintf("$BI=<($9$kJ8;zNs$H=q<0;XDj;R(J", $BJQ?tL>(J);
$B!!!!!!!!!!!!(Jprintf("$B$o$?$7$NL>A0$O(J %s $B$H$$$$$^$9!#G/Np$O(J %d $B:M$G$9!#(J\n",namae, toshi );

$B!!$H$3$m$G!"CM$NF~=PNO$O(J printf()$B!"(Jscanf() $B$H$OJL$K!"0J2<$N$*$^$1$N%W%m%0%i%`$K<($94X?t$,$"$j$^$9!#(J $B$?$a$7$F$_$F$/$@$5$$!#$^$?!"%(%9%1!<%WJ8;z$N;H$$J}$b3P$($F$_$F$/$@$5$$!#(J

$B!|!!(Jscanf$B4X?t$N;H$$J}(J
$B!Z=q<0![(J$B!!!!(Jscanf("$B=q<0;XDj;R(J", &$BJQ?tL>(J);
$B!!!!!!!!!!!!(Jscanf("%s %d",namae, &toshi );

$B$*$^$1!!NcJ8#1(J $B%-!<%\!<%I$+$i$N#1J8;zF~NO(J --------------------------------------------------- #include <stdio.h> main() { int c; /* int$B7?$NJQ?t(J c $B$r@k8@(J */ c = getchar(); /* $B%-!<%\!<%I$+$i#1J8;zF~NO(J */ putchar(c); /* c $B$NFbMF$r=PNO(J */ } $B$*$^$1!!NcJ8#2(J gets()$B!"(Jputs() $B4X?t$r;H$&(J ---------------------------------------------------- #include <stdio.h> main() { char msg[126]; /* char$B7?$NJ8;zG[Ns(J msg $B$rJ8;z?t(J126$BJ8;z$G@k8@(J */ gets(msg); /* $B%-!<%\!<%I$+$iJ8;zNsF~NO(J */ puts(msg); /* msg $B$NFbMF$rJ8;zNs=PNO(J */ } $B$*$^$1!!NcJ8#3(J $B%(%9%1!<%W5-9f$H5!G=(J -------------------------------------------------------- /* namx.c */ #include <stdio.h> main() { printf("michio\t"); printf("michio\n"); printf("michio\b"); printf("michio\f"); printf("michio"); }

$B!!2hLL$K=PNO$9$k$?$a$K$O!"I=(J2_5 $B$N%(%9%1!<%WJ8;z$r;H$C$F@Q6KE*$K2~9T!"%?%VA`:n$9$kI,MW$,$"$j$^$9!#(J $B$^$?!"JQ?t$NFbMF$r=PNO$9$k$K$O!"I=(J2_6 $B$N=q<0;XDj;R$rA*Br$9$kI,MW$,$"$j$^$9!#(J

$BI=(J2_5 $B%(%9%1!<%WJ8;z(J
$B5-9f(J $BF0:n(J
\n $B2~9T(I%%$B%+!<%=%k$r
\r $BI|5"(I%%$B%+!<%=%k$r9T$N:8C<$K0LCVIU$1$k(J
\t $B%?%V(I%%$B%+!<%=%k$r
\0 $B%L%k(I%%$B6u$N0UL#(J
\(IS(J $B!HJ8;z(I%%$BJ8;zNs$NCf$G!I5-9f$rI=<($9$k$H$-$K;H$&(J
\(IU(J $B!FJ8;z(I%%$BJ8;zNs$NCf$G!G5-9f$rI=<($9$k$H$-$K;H$&(J

$BI=(J2_6 $B=q<0;XDj;R(J
$B=q<0;XDj;R(J $B%G!<%?7?(J
%c char
%s $BJ8;zNs$X$N%]%$%s%?(J
%hd short int
%d int
%ld long int
%f float
%lf double

$B!|!!7e?t$r7h$a$F?tCM$r=PNO$9$k(J
$B!Z=q<0![(J$B!!!!(J%[$BM-8z7e?t(J][.$B@:EY(J]$B=q<0;XDj;R(J
$B!!!!!!!!!!!!(J%5.2f$B!!!!M-8z7e?t$r#57e!"@:EY$r#27e$K$9$k(J

$B!!;MB'1i;;$r%^%9%?!<$9$k(J

$B!!$=$l$G$O!"0J2<$N(IX=D(J2.2 $B$NDL$j$K%W%m%0%i%`$rF~NO!"J]B8!"%3%s%Q%$%k$7$F

(IX=D(J2.2 $B=q<0;XDjF~NO(J ----------------------------------------------------------------------- #include <stdio.h> main() { int a, b, c; /* int$B7?$NJQ?t(J a, b, c $B$N@k8@(J */ scanf("%d", &a); /* $B%-!<%\!<%I$+$i(J a $B$KF~NO(J */ scanf("%d", &b); /* $B%-!<%\!<%I$+$i(J b $B$KF~NO(J */ c = a - b; /* a $B$+$i(J b $B$r0z$$$?7k2L$r(J c $B$KBeF~(J */ printf("%d - %d = %d\n", a, b, c); /* a, b, c $B$NFbMF$r=PNO$7$F2~9T(J */ } (IX=D(J2.3 $B#2$D$N?t$N;MB'7W;;(J ----------------------------------------------------------------- #include <stdio.h> main() { float a = 2.0, b = 3.0, c; /* float$B7?$NJQ?t(J a, b, c $B$N@k8@(J */ c = a + b; /* $B2C;;(J */ printf("%f + %f = %f\n", a, b, c); /* c $B$NFbMF$r=PNO$7$F2~9T(J */ c = a - b; /* $B8:;;(J */ printf("%f - %f = %f\n", a, b, c); /* c $B$NFbMF$r=PNO$7$F2~9T(J */ c = a * b; /* $B>h;;(J */ printf("%f * %f = %f\n", a, b, c); /* c $B$NFbMF$r=PNO$7$F2~9T(J */ c = a / b; /* $B=|;;(J */ printf("%f / %f = %f\n", a, b, c); /* c $B$NFbMF$r=PNO$7$F2~9T(J */ } $B$*$^$1!!NcJ8#4(J $B$$$m$$$m$J?tCM$N%W%j%s%H(J ---------------------------------------------------- /* varip.c */ #include <stdio.h> #define ALPHA 65 // ALPHA $B$r?tCM$KF~$lBX$($k(J main() { int ch; ch = ALPHA; /* $BJQ?t(J ch $B$NCM$r!!J8;z!!(J10$B?J?t!!#8?J?t!!(J16$B?J?t!!(J10$B?J?t@dBPCM$G=PNO(J */$B!!(J printf("%c = %d = 0%o = 0x%x, %u", ch, ch, ch, ch, -ch); }

$B!!#C$N%W%m%0%i%`$K$O!"B?$/$N%W%m%0%i%_%s%08@8l$HF1MM$N;;=Q1i;;;R$N$[$+$K!"(J $B#CFHFC$N1i;;;R$H$7$FBeF~1i;;;R!"%$%s%/%j%a%s%H!&%G%/%j%a%s%H1i;;;R!"(J $B%-%c%9%H!J7?JQ49!K1i;;;R$,$"$j$^$9!#(J
$B!!(IX=D(J2.4 $B$G$O%$%s%/%j%a%s%H!&%G%/%j%a%s%H1i;;;R$r;H$C$?%W%m%0%i%`!"(J (IX=D(J2.5 $B$G$O%-%c%9%H!J7?JQ49!K1i;;;R$r;H$C$?%W%m%0%i%`$NNc$G$9!#(J $B@0?tF1;N$N3d$j;;$G$O!"7W;;7k2L$O@0?t$K4]$a$i$l$F$7$^$$$^$9$N$G!"(J $B%-%c%9%H1i;;;R$r;H$C$F@0?t$r

$B!|!!%G!<%?7?$NJQ49(J
$B!Z=q<0![(J$B!!!!(J($B%G!<%?7?(J) $B<0(J
$B!!!!!!!!!!!!(J( float ) intA

(IX=D(J2.4 $B#1$r2C$($k7W;;(J --------------------------------------------------------------------- #include <stdio.h> main() { int a, b, c; /* int$B7?$NJQ?t(J a, b, c $B$N@k8@(J */ a = 12; /* 12 $B$r(J a $B$KBeF~(J */ b = ++a; /* a $B$K(J 1 $B$r2C$($?CM$r(J b $B$KBeF~(J */ c = a++; /* a $B$NCM$r(J c $B$KBeF~8e(J a $B$K(J 1 $B2C$($k(J */ printf("%d, %d, %d\n", a, b, c); /* a, b, c $B$NFbMF$r=PNO$7$F2~9T(J */ } (IX=D(J2.5 $B7?JQ491i;;;R$r;H$C$?:.9g7W;;(J ------------------------------------------------------- #include <stdio.h> main() { float a, b, f = 40; /* float$B7?$NJQ?t(J a,b,f $B$r@k8@$7!$(Jf $B$K(J40$B$rBeF~(J */ a = (5 / 8) * (f - 32); /* (5/8)*(f-32)$B$r7W;;$7!$(Ja $B$KBeF~(J */ b = ((float)5 / (float)8) * (f - 32); /* (5.0/8.0)*(f-32)$B$r7W;;$7!$(Jb $B$KBeF~(J */ printf("a = %f\n", a); /* a $B$NFbMF$r=PNO$7$F2~9T(J */ printf("b = %f\n", b); /* b $B$NFbMF$r=PNO$7$F2~9T(J */ }

$BI=(J2_7 $B;;=Q1i;;;R(J
$B1i;;;R(J $B1i;;(J $B=q<0(J $B0UL#(J
$B!\(J $B2C;;(J a + b a $B$K(J b $B$r2C$($k(J
$B!](J $B8:;:(J a - b a $B$+$i(J b $B$r0z$/(J
* $B>h;;(J a * b a $B$K(J b $B$r3]$1$k(J
/ $B=|;;(J a / b a $B$r(J b $B$G3d$k(J
% $B>jM>;;(J a % b a $B$r(J b $B$G3d$C$?M>$j$r5a$a$k(J

$BI=(J2_8 $BBeF~1i;;;R(J
$B1i;;;R(J $B1i;;(J $B=q<0(J $B0UL#(J
= $BBeF~(J a = b a = b
$B!\(J= $B2C;;$HBeF~(J a += b a = a + b
$B!](J= $B8:;:$HBeF~(J a -= b a = a - b
*= $B>h;;$HBeF~(J a *= b a = a * b
/= $B=|;;$HBeF~(J a /= b a = a / b
%= $B>jM>;;$HBeF~(J a %= b a = a % b


$B!!2]Bj(J

$B2]Bj#1(J $B!!E75$$r$?$:$M$?$j!"0';"$r8r$o$9%W%m%0%i%`$r:n$j$J$5$$!#(J

$BF~NO2hLL$NNc(J
$B0';"%W%m%0%i%`(J
$BL>A0$O!'(J$B!&!&!&!&(J
$B$"$J$?$NL>A0$O(J
$B!&!&!&!&(J
$B$G$9!#(J
$B:#F|$NE75$$O!'(J$B@2$l(J
$B:#F|$NE75$$O(J
$B@2$l(J
$B$G$9!#(J
$BCm!K(J$B@D?'ItJ,(J$B$,F~NO$7$?CM$G$9!#(J

$B2]Bj#2(J $B0J2<$N8x<0$K$h$j!"@];a$r2Z;a$KJQ49$9$k%W%m%0%i%`$r=q$-$J$5$$!#(J $B$J$*!"JQ?t$O $B7W;;<0$O(J
$B!!!!!!#9(J
$B!!#F!a!](J $B#C!\(J32
$B!!!!!!#5(J
$B$G$9!#(J

$BF~NO2hLL$NNc(J
$B@];a$r2Z;a$KJQ49$9$k%W%m%0%i%`(J
$B@];a(J = 12
$B2Z;a(J = 52.6
$BCm!K(J$B@D?'ItJ,(J$B$,F~NO$7$?CM!"(J $B>.?tE@0J2<(J 1 $B7e$^$GI=<($5$;$k!#(J


$B"%#C8@8lL\


Copyrights(c) 2000 $B%6%6Cn(J. All rights reserved.