Showing posts with label C (programming language). Show all posts
Showing posts with label C (programming language). Show all posts

Sunday, January 1, 2017

C (programming): ジャンボ宝くじシミュレーション

Command:

$ cat takarakuji.c


Result:

#include<stdio.h>
#include<stdlib.h>
#include<time.h>

void firstPrize(){
printf("%d組%d番\n", (rand() % 20 * 10) + (rand() % 10), ((rand() % 10 + 10) * 10000) + (rand() % 10000));
}

void secondPrize(){
printf("組下1ケタ%d組%d番\n", rand() % 10, ((rand() % 10 + 10) * 10000) + (rand() % 10000));
}

void thirdPrize(){
printf("各組共通%d番\n", ((rand() % 10 + 10) * 10000) + (rand() % 10000));
}

void fourthPrize(){
printf("下3ケタ%d番\n", rand() % 1000);
}

void fifthPrize(){
printf("下2ケタ%d番\n", rand() % 100);
}

void sixthPrize(){
printf("下1ケタ%d番\n", rand() % 10);
}

int main(){
srand((unsigned)time(NULL));

printf("1等7億円\n");
firstPrize();
printf("\n2等1500万円\n");
secondPrize();
printf("\n3等100万円\n");
thirdPrize();
printf("\n4等1万円\n");
fourthPrize();
printf("\n5等3000円\n");
fifthPrize();
printf("\n6等300円\n");
sixthPrize();

return 0;
}


Command:

$ gcc takarakuji.c -o takarakuji
$ ./takarakuji


Result:

1等7億円
93組160341番

2等1500万円
組下1ケタ8組117976番

3等100万円
各組共通166224番

4等1万円
下3ケタ984番

5等3000円
下2ケタ25番

6等300円
下1ケタ6番

Wednesday, December 14, 2016

C (programming language): Summation of Arithmetic Progression with Common Difference of 1

Command:

$ cat summation1.c


Result:

#include<stdio.h>
#include<stdlib.h>
int main(int argc, char* argv[]){
        if(argc!=2){
               printf("Bad argument\n");
               exit(1);
        }
        long int a=0;
        for (long int i=1; i<=atoi(argv[1]); i++){
               a+=i;
        }
        printf("%ld\n",a);
        return 0;
}


Command:

$ cat summation2.c


Result:

#include<stdio.h>
#include<stdlib.h>
int main(int argc, char* argv[]){
  if (argc != 2){
printf("Bad argument\n");
exit(1);
}
long int a = 0;
long int n = atoi(argv[1]);
a = (n*(n+1))/2;
printf("%ld\n", a);
         return 0;
}


Command:

$ gcc -o summation1 summation1.c
$ gcc -o summation2 summation2.c
$ time ./summation1 100000000


Result:

5000000050000000

real 0m3.517s
user 0m3.511s
sys 0m0.002s


Command:

$ time ./summation2 100000000


Result:

5000000050000000

real 0m0.005s
user 0m0.001s
sys 0m0.001s


Saturday, October 29, 2016

macOS Sierra: C (programming language): Hello World for NES

Command:

$ ls


Result:


NESBatchFile.sh hello.c


Command:

$ cat hello.c


Result:

/*
Hello, NES!
      writes "Hello, NES!" to the screen

written by WolfCoder (2010)
*/

/* Includes */
#include <nes.h>

/* Writes the string to the screen */
/* Note how the NES hardware itself automatically moves the position we write to the screen */
void write_string(char *str)
{
/* Position the cursor */
/* We only need to do this once */
/* This is actually 2 cells down since the first 8 pixels from the top of the screen is hidden */
*((unsigned char*)0x2006) = 0x20;
*((unsigned char*)0x2006) = 0x41;
/* Write the string */
while(*str)
{
/* Write a letter */
/* The compiler put a set of graphics that match ASCII */
*((unsigned char*)0x2007) = *str;
/* Advance pointer that reads from the string */
str++;
}
}

/* Program entry */
int main()
{
/* We have to wait for VBLANK or we can't even use the PPU */
  waitvblank(); /* This is found in nes.h */

/* This is a really strange way to set colors, don't you think? */
/* First, we need to set the background color */
*((unsigned char*)0x2006) = 0x3F;
*((unsigned char*)0x2006) = 0x00;
*((unsigned char*)0x2007) = 1;
/* Then, we need to set the text color */
*((unsigned char*)0x2006) = 0x3F;
*((unsigned char*)0x2006) = 0x03;
*((unsigned char*)0x2007) = 0x30;

/* We must write our message to the screen */
write_string("Hello, NES!");

/* Set the screen position */
/* First value written sets the X offset and the second is the Y offset */
*((unsigned char*)0x2005) = 0x00;
*((unsigned char*)0x2005) = 0x00;

/* Enable the screen */
/* By default, the screen and sprites were off */
*((unsigned char*)0x2001) = 8;

/* Wait */
/* The compiler seems to loop the main function over and over, so we need to hold it here */
while(1);
                       
return 0;
}


Command:

$ cat NESBatchFile.sh


Result:

~/cc65/bin/cl65 -L ~/cc65/Lib -t nes -I ~/cc65/include hello.c -o hello.nes


Command:

$ sh NESBatchFile.sh
$ ls


Result:

NESBatchFile.sh hello.c hello.nes hello.o


Sunday, October 16, 2016

C (programming language): Displaying Printing ASCII Characters

Command:

$ cat testascii.c


Result:

#include<stdio.h>
#include<ctype.h>
int main(void){
for(int i=0;i<=255;i++){
if (isprint((char)i)){
printf("%3d:%c\n", i, i);
}
}
return 0;

}


Command:

$ gcc testascii.c
$ ./a.out


Result:

 32:
 33:!
 34:"
 35:#
 36:$
 37:%
 38:&
 39:'
 40:(
 41:)
 42:*
 43:+
 44:,
 45:-
 46:.
 47:/
 48:0
 49:1
 50:2
 51:3
 52:4
 53:5
 54:6
 55:7
 56:8
 57:9
 58::
 59:;
 60:<
 61:=
 62:>
 63:?
 64:@
 65:A
 66:B
 67:C
 68:D
 69:E
 70:F
 71:G
 72:H
 73:I
 74:J
 75:K
 76:L
 77:M
 78:N
 79:O
 80:P
 81:Q
 82:R
 83:S
 84:T
 85:U
 86:V
 87:W
 88:X
 89:Y
 90:Z
 91:[
 92:\
 93:]
 94:^
 95:_
 96:`
 97:a
 98:b
 99:c
100:d
101:e
102:f
103:g
104:h
105:i
106:j
107:k
108:l
109:m
110:n
111:o
112:p
113:q
114:r
115:s
116:t
117:u
118:v
119:w
120:x
121:y
122:z
123:{
124:|
125:}
126:~

Thursday, October 13, 2016

C (programming language): Macro Constants

Command:

$ cat limitslib.c


Result:

#include<stdio.h>
#include<limits.h>
#include<float.h>

int main(){
printf("CHAR_BIT:%d\n", CHAR_BIT);
printf("SCHAR_MIN:%d\n", SCHAR_MIN);
printf("SHRT_MIN:%d\n", SHRT_MIN);
printf("INT_MIN:%d\n", INT_MIN);
printf("LONG_MIN:%ld\n",LONG_MIN);
printf("LLONG_MIN:%lld\n",LLONG_MIN);
printf("SCHAR_MAX:%d\n",SCHAR_MAX);
printf("SHRT_MAX:%d\n", SHRT_MAX);
printf("INT_MAX:%d\n", INT_MAX);
printf("LONG_MAX:%ld\n", LONG_MAX);
printf("LLONG_MAX:%lld\n", LLONG_MAX);
printf("UCHAR_MAX:%d\n", UCHAR_MAX);
printf("USHRT_MAX:%d\n", USHRT_MAX);
printf("UINT_MAX:%d\n", UINT_MAX);
printf("ULONG_MAX:%ld\n", ULONG_MAX);
printf("ULLONG_MAX:%lld\n", ULLONG_MAX);
printf("CHAR_MIN:%d\n", CHAR_MIN);
printf("CHAR_MAX:%d\n", CHAR_MAX);
printf("MB_LEN_MAX:%d\n", MB_LEN_MAX);
printf("FLT_MIN:%f\n", FLT_MIN);
printf("DBL_MIN:%f\n", DBL_MIN);
printf("LDBL_MIN:%Lf\n", LDBL_MIN);
printf("FLT_TRUE_MIN:%f\n", FLT_TRUE_MIN);
printf("DBL_TRUE_MIN:%f\n", DBL_TRUE_MIN);
printf("LDBL_TRUE_MIN:%Lf\n", LDBL_TRUE_MIN);
printf("FLT_MAX:%f\n", FLT_MAX);
printf("DBL_MAX:%f\n", DBL_MAX);
printf("LDBL_MAX:%Lf\n", LDBL_MAX);
printf("FLT_ROUNDS:%d\n", FLT_ROUNDS);
printf("FLT_EVAL_METHOD:%d\n", FLT_EVAL_METHOD);
printf("FLT_RADIX:%d\n", FLT_RADIX);
printf("FLT_DIG:%d\n", FLT_DIG);
printf("DBL_DIG:%d\n", DBL_DIG);
printf("LDBL_DIG:%d\n", LDBL_DIG);
printf("FLT_EPSILON:%f\n", FLT_EPSILON);
printf("DBL_EPSILON:%f\n", DBL_EPSILON);
printf("LDBL_EPSILON:%Lf\n", LDBL_EPSILON);
printf("FLT_MANT_DIG:%d\n", FLT_MANT_DIG);
printf("DBL_MANT_DIG:%d\n", DBL_MANT_DIG);
printf("LDBL_MANT_DIG:%d\n", LDBL_MANT_DIG);
printf("FLT_MIN_EXP:%d\n", FLT_MIN_EXP);
printf("DBL_MIN_EXP:%d\n", DBL_MIN_EXP);
printf("LDBL_MIN_EXP:%d\n",LDBL_MIN_EXP);
printf("FLT_MIN_10_EXP:%d\n", FLT_MIN_10_EXP);
printf("DBL_MIN_10_EXP:%d\n", DBL_MIN_10_EXP);
printf("LDBL_MIN_10_EXP:%d\n", LDBL_MIN_10_EXP);
printf("FLT_MAX_EXP:%d\n", FLT_MAX_EXP);
printf("DBL_MAX_EXP:%d\n", DBL_MAX_EXP);
printf("LDBL_MAX_EXP:%d\n", LDBL_MAX_EXP);
printf("FLT_MAX_10_EXP:%d\n", FLT_MAX_10_EXP);
printf("DBL_MAX_10_EXP:%d\n", DBL_MAX_10_EXP);
printf("LDBL_MAX_10_EXP:%d\n", LDBL_MAX_10_EXP);
printf("DECIMAL_DIG:%d\n", DECIMAL_DIG);

return 0;
}


Command:

$ gcc limitslib.c
$ ./a.out


Result:

CHAR_BIT:8
SCHAR_MIN:-128
SHRT_MIN:-32768
INT_MIN:-2147483648
LONG_MIN:-9223372036854775808
LLONG_MIN:-9223372036854775808
SCHAR_MAX:127
SHRT_MAX:32767
INT_MAX:2147483647
LONG_MAX:9223372036854775807
LLONG_MAX:9223372036854775807
UCHAR_MAX:255
USHRT_MAX:65535
UINT_MAX:-1
ULONG_MAX:-1
ULLONG_MAX:-1
CHAR_MIN:-128
CHAR_MAX:127
MB_LEN_MAX:6
FLT_MIN:0.000000
DBL_MIN:0.000000
LDBL_MIN:0.000000
FLT_TRUE_MIN:0.000000
DBL_TRUE_MIN:0.000000
LDBL_TRUE_MIN:0.000000
FLT_MAX:340282346638528859811704183484516925440.000000
DBL_MAX:179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000
LDBL_MAX:1189731495357231765021263853030970205169063322294624200440323733891737005522970722616410290336528882853545697807495577314427443153670288434198125573853743678673593200706973263201915918282961524365529510646791086614311790632169778838896134786560600399148753433211454911160088679845154866512852340149773037600009125479393966223151383622417838542743917838138717805889487540575168226347659235576974805113725649020884855222494791399377585026011773549180099796226026859508558883608159846900235645132346594476384939859276456284579661772930407806609229102715046085388087959327781622986827547830768080040150694942303411728957777100335714010559775242124057347007386251660110828379119623008469277200965153500208474470792443848545912886723000619085126472111951361467527633519562927597957250278002980795904193139603021470997035276467445530922022679656280991498232083329641241038509239184734786121921697210543484287048353408113042573002216421348917347174234800714880751002064390517234247656004721768096486107994943415703476320643558624207443504424380566136017608837478165389027809576975977286860071487028287955567141404632615832623602762896316173978484254486860609948270867968048078702511858930838546584223040908805996294594586201903766048446790926002225410530775901065760671347200125846406957030257138960983757998926954553052368560758683179223113639519468850880771872104705203957587480013143131444254943919940175753169339392366881856189129931729104252921236835159922322050998001677102784035360140829296398115122877768135706045789343535451696539561254048846447169786893211671087229088082778350518228857646062218739702851655083720992349483334435228984751232753726636066213902281264706234075352071724058665079518217303463782631353393706774901950197841690441824738063162828586857741432581165364040218402724913393320949219498422442730427019873044536620350262386957804682003601447291997123095530057206141866974852846856186514832715974481203121946751686379343096189615107330065552421485195201762858595091051839472502863871632494167613804996319791441870254302706758495192008837915169401581740046711477877201459644461175204059453504764721807975761111720846273639279600339670470037613374509553184150073796412605047923251661354841291884211340823015473304754067072818763503617332908005951896325207071673904547777129682265206225651439919376804400292380903112437912614776255964694221981375146967079446870358004392507659451618379811859392049544036114915310782251072691486979809240946772142727012404377187409216756613634938900451232351668146089322400697993176017805338191849981933008410985993938760292601390911414526003720284872132411955424282101831204216104467404621635336900583664606591156298764745525068145003932941404131495400677602951005962253022823003631473824681059648442441324864573137437595096416168048024129351876204668135636877532814675538798871771836512893947195335061885003267607354388673368002074387849657014576090349857571243045102038730494854256702479339322809110526041538528994849203991091946129912491633289917998094380337879522093131466946149705939664152375949285890960489916121944989986384837022486672249148924678410206183364627416969576307632480235587975245253737035433882960862753427740016333434055083537048507374544819754722228975281083020898682633020285259923084168054539687911418297629988964576482765287504562854924265165217750799516259669229114977788962356670956627138482018191348321687995863652637620978285070099337294396784639879024914514222742527006363942327998483976739987154418554201562244154926653014515504685489258620276085761837129763358761215382565129633538141663949516556000264159186554850057052611431952919918807954522394649627635630178580896692226406235382898535867595990647008385687123810329591926494846250768992258419305480763620215089022149220528069842018350840586938493815498909445461977893029113576516775406232278298314033473276603952231603422824717528181818844304880921321933550869873395861276073670866652375555675803171490108477320096424318780070008797346032906278943553743564448851907191616455141155761939399690767415156402826543664026760095087523945507341556135867933066031744720924446513532366647649735400851967040771103640538150073486891798364049570606189535005089840913826869535090066783324472578712196604415284924840041850932811908963634175739897166596000759487800619164094854338758520657116541072260996288150123144377944008749301944744330784388995701842710004808305012177123560622895076269042856800047718893158089358515593863176652948089031267747029662545110861548958395087796755464137944895960527975209874813839762578592105756284401759349324162148339565350189196811389091843795734703269406342890087805846940352453479398080674273236297887100867175802531561302356064878709259865288416350972529537091114317204887747405539054009425375424119317944175137064689643861517718849867010341532542385911089624710885385808688837777258648564145934262121086647588489260031762345960769508849149662444156604419552086811989770240.000000
FLT_ROUNDS:1
FLT_EVAL_METHOD:0
FLT_RADIX:2
FLT_DIG:6
DBL_DIG:15
LDBL_DIG:18
FLT_EPSILON:0.000000
DBL_EPSILON:0.000000
LDBL_EPSILON:0.000000
FLT_MANT_DIG:24
DBL_MANT_DIG:53
LDBL_MANT_DIG:64
FLT_MIN_EXP:-125
DBL_MIN_EXP:-1021
LDBL_MIN_EXP:-16381
FLT_MIN_10_EXP:-37
DBL_MIN_10_EXP:-307
LDBL_MIN_10_EXP:-4931
FLT_MAX_EXP:128
DBL_MAX_EXP:1024
LDBL_MAX_EXP:16384
FLT_MAX_10_EXP:38
DBL_MAX_10_EXP:308
LDBL_MAX_10_EXP:4932
DECIMAL_DIG:21

C (programming language): Sizeof Data Types

Command:

$ cat testsizeof.c


Result:

#include<stdio.h>
int main(){
char str[32];
int ints[16];
long double lds[8];

printf("%lu\n", sizeof(void));
printf("%lu\n", sizeof(char));
printf("%lu\n", sizeof(unsigned char));
printf("%lu\n", sizeof(signed char));
printf("%lu\n", sizeof(short));
printf("%lu\n", sizeof(unsigned short));
printf("%lu\n", sizeof(int));
printf("%lu\n", sizeof(unsigned int));
printf("%lu\n", sizeof(long));
printf("%lu\n", sizeof(unsigned long));
printf("%lu\n", sizeof(float));
printf("%lu\n", sizeof(double));
printf("%lu\n", sizeof(long double));
printf("%lu\n", sizeof(str));
printf("%lu\n", sizeof(ints));
printf("%lu\n", sizeof(lds));

return 0;
}


Command:

$ gcc testsizeof.c 
$ ./a.out 


Result:

1
1
1
1
2
2
4
4
8
8
4
8
16
32
64
128

C (programming language): time (Unix): The Duration of Execution of Printing Out 1 to 120,000,000

Command:

$ cat 120million.c


Result:

#include<stdio.h>

int main()
{
for (long n=1; n<=120000000; n++){
printf("%ld\n", n);
}
}


Command:

$ gcc 120million.c
$ time ./a.out


Result:

1
2
3
...
119999998
119999999
120000000

real 3m10.250s
user 0m40.043s
sys 1m5.333s

C (programming language): Power of Two

Command:

$ cat poweroftwo.c


Result:

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

int main(){
for (int n=1; n <= 100; n++){
printf("%d:%ld\n", n, (long) pow(2,n));
}
return 0;
}


Command:

$ gcc poweroftwo.c
$ ./a.out


Result:

1:2
2:4
3:8
4:16
5:32
6:64
7:128
8:256
9:512
10:1024
11:2048
12:4096
13:8192
14:16384
15:32768
16:65536
17:131072
18:262144
19:524288
20:1048576
21:2097152
22:4194304
23:8388608
24:16777216
25:33554432
26:67108864
27:134217728
28:268435456
29:536870912
30:1073741824
31:2147483648
32:4294967296
33:8589934592
34:17179869184
35:34359738368
36:68719476736
37:137438953472
38:274877906944
39:549755813888
40:1099511627776
41:2199023255552
42:4398046511104
43:8796093022208
44:17592186044416
45:35184372088832
46:70368744177664
47:140737488355328
48:281474976710656
49:562949953421312
50:1125899906842624
51:2251799813685248
52:4503599627370496
53:9007199254740992
54:18014398509481984
55:36028797018963968
56:72057594037927936
57:144115188075855872
58:288230376151711744
59:576460752303423488
60:1152921504606846976
61:2305843009213693952
62:4611686018427387904
63:-9223372036854775808
64:-9223372036854775808
65:-9223372036854775808
66:-9223372036854775808
67:-9223372036854775808
68:-9223372036854775808
69:-9223372036854775808
70:-9223372036854775808
71:-9223372036854775808
72:-9223372036854775808
73:-9223372036854775808
74:-9223372036854775808
75:-9223372036854775808
76:-9223372036854775808
77:-9223372036854775808
78:-9223372036854775808
79:-9223372036854775808
80:-9223372036854775808
81:-9223372036854775808
82:-9223372036854775808
83:-9223372036854775808
84:-9223372036854775808
85:-9223372036854775808
86:-9223372036854775808
87:-9223372036854775808
88:-9223372036854775808
89:-9223372036854775808
90:-9223372036854775808
91:-9223372036854775808
92:-9223372036854775808
93:-9223372036854775808
94:-9223372036854775808
95:-9223372036854775808
96:-9223372036854775808
97:-9223372036854775808
98:-9223372036854775808
99:-9223372036854775808
100:-9223372036854775808

C (programming language): 1 / 2^n

Command:

$ cat testmath.c


Result:

#include <stdio.h>
#include <math.h>
#include <float.h>

int main(){

int i = 1;

for (int i = 1; i <= 84; i++)
{
printf("%d:%.84f\n", i, 1.0/pow(2,i));
}
}


Command:

$ gcc testmath.c
$ ./a.out


Result:

1:0.500000000000000000000000000000000000000000000000000000000000000000000000000000000000
2:0.250000000000000000000000000000000000000000000000000000000000000000000000000000000000
3:0.125000000000000000000000000000000000000000000000000000000000000000000000000000000000
4:0.062500000000000000000000000000000000000000000000000000000000000000000000000000000000
5:0.031250000000000000000000000000000000000000000000000000000000000000000000000000000000
6:0.015625000000000000000000000000000000000000000000000000000000000000000000000000000000
7:0.007812500000000000000000000000000000000000000000000000000000000000000000000000000000
8:0.003906250000000000000000000000000000000000000000000000000000000000000000000000000000
9:0.001953125000000000000000000000000000000000000000000000000000000000000000000000000000
10:0.000976562500000000000000000000000000000000000000000000000000000000000000000000000000
11:0.000488281250000000000000000000000000000000000000000000000000000000000000000000000000
12:0.000244140625000000000000000000000000000000000000000000000000000000000000000000000000
13:0.000122070312500000000000000000000000000000000000000000000000000000000000000000000000
14:0.000061035156250000000000000000000000000000000000000000000000000000000000000000000000
15:0.000030517578125000000000000000000000000000000000000000000000000000000000000000000000
16:0.000015258789062500000000000000000000000000000000000000000000000000000000000000000000
17:0.000007629394531250000000000000000000000000000000000000000000000000000000000000000000
18:0.000003814697265625000000000000000000000000000000000000000000000000000000000000000000
19:0.000001907348632812500000000000000000000000000000000000000000000000000000000000000000
20:0.000000953674316406250000000000000000000000000000000000000000000000000000000000000000
21:0.000000476837158203125000000000000000000000000000000000000000000000000000000000000000
22:0.000000238418579101562500000000000000000000000000000000000000000000000000000000000000
23:0.000000119209289550781250000000000000000000000000000000000000000000000000000000000000
24:0.000000059604644775390625000000000000000000000000000000000000000000000000000000000000
25:0.000000029802322387695312500000000000000000000000000000000000000000000000000000000000
26:0.000000014901161193847656250000000000000000000000000000000000000000000000000000000000
27:0.000000007450580596923828125000000000000000000000000000000000000000000000000000000000
28:0.000000003725290298461914062500000000000000000000000000000000000000000000000000000000
29:0.000000001862645149230957031250000000000000000000000000000000000000000000000000000000
30:0.000000000931322574615478515625000000000000000000000000000000000000000000000000000000
31:0.000000000465661287307739257812500000000000000000000000000000000000000000000000000000
32:0.000000000232830643653869628906250000000000000000000000000000000000000000000000000000
33:0.000000000116415321826934814453125000000000000000000000000000000000000000000000000000
34:0.000000000058207660913467407226562500000000000000000000000000000000000000000000000000
35:0.000000000029103830456733703613281250000000000000000000000000000000000000000000000000
36:0.000000000014551915228366851806640625000000000000000000000000000000000000000000000000
37:0.000000000007275957614183425903320312500000000000000000000000000000000000000000000000
38:0.000000000003637978807091712951660156250000000000000000000000000000000000000000000000
39:0.000000000001818989403545856475830078125000000000000000000000000000000000000000000000
40:0.000000000000909494701772928237915039062500000000000000000000000000000000000000000000
41:0.000000000000454747350886464118957519531250000000000000000000000000000000000000000000
42:0.000000000000227373675443232059478759765625000000000000000000000000000000000000000000
43:0.000000000000113686837721616029739379882812500000000000000000000000000000000000000000
44:0.000000000000056843418860808014869689941406250000000000000000000000000000000000000000
45:0.000000000000028421709430404007434844970703125000000000000000000000000000000000000000
46:0.000000000000014210854715202003717422485351562500000000000000000000000000000000000000
47:0.000000000000007105427357601001858711242675781250000000000000000000000000000000000000
48:0.000000000000003552713678800500929355621337890625000000000000000000000000000000000000
49:0.000000000000001776356839400250464677810668945312500000000000000000000000000000000000
50:0.000000000000000888178419700125232338905334472656250000000000000000000000000000000000
51:0.000000000000000444089209850062616169452667236328125000000000000000000000000000000000
52:0.000000000000000222044604925031308084726333618164062500000000000000000000000000000000
53:0.000000000000000111022302462515654042363166809082031250000000000000000000000000000000
54:0.000000000000000055511151231257827021181583404541015625000000000000000000000000000000
55:0.000000000000000027755575615628913510590791702270507812500000000000000000000000000000
56:0.000000000000000013877787807814456755295395851135253906250000000000000000000000000000
57:0.000000000000000006938893903907228377647697925567626953125000000000000000000000000000
58:0.000000000000000003469446951953614188823848962783813476562500000000000000000000000000
59:0.000000000000000001734723475976807094411924481391906738281250000000000000000000000000
60:0.000000000000000000867361737988403547205962240695953369140625000000000000000000000000
61:0.000000000000000000433680868994201773602981120347976684570312500000000000000000000000
62:0.000000000000000000216840434497100886801490560173988342285156250000000000000000000000
63:0.000000000000000000108420217248550443400745280086994171142578125000000000000000000000
64:0.000000000000000000054210108624275221700372640043497085571289062500000000000000000000
65:0.000000000000000000027105054312137610850186320021748542785644531250000000000000000000
66:0.000000000000000000013552527156068805425093160010874271392822265625000000000000000000
67:0.000000000000000000006776263578034402712546580005437135696411132812500000000000000000
68:0.000000000000000000003388131789017201356273290002718567848205566406250000000000000000
69:0.000000000000000000001694065894508600678136645001359283924102783203125000000000000000
70:0.000000000000000000000847032947254300339068322500679641962051391601562500000000000000
71:0.000000000000000000000423516473627150169534161250339820981025695800781250000000000000
72:0.000000000000000000000211758236813575084767080625169910490512847900390625000000000000
73:0.000000000000000000000105879118406787542383540312584955245256423950195312500000000000
74:0.000000000000000000000052939559203393771191770156292477622628211975097656250000000000
75:0.000000000000000000000026469779601696885595885078146238811314105987548828125000000000
76:0.000000000000000000000013234889800848442797942539073119405657052993774414062500000000
77:0.000000000000000000000006617444900424221398971269536559702828526496887207031250000000
78:0.000000000000000000000003308722450212110699485634768279851414263248443603515625000000
79:0.000000000000000000000001654361225106055349742817384139925707131624221801757812500000
80:0.000000000000000000000000827180612553027674871408692069962853565812110900878906250000
81:0.000000000000000000000000413590306276513837435704346034981426782906055450439453125000
82:0.000000000000000000000000206795153138256918717852173017490713391453027725219726562500
83:0.000000000000000000000000103397576569128459358926086508745356695726513862609863281250
84:0.000000000000000000000000051698788284564229679463043254372678347863256931304931640625

Tuesday, September 2, 2014

C:C standard library:Header files

C Standard Library
  • assert.h
  • complex.h
  • ctype.h
  • errno.h
  • fenv.h
  • float.h
  • inttypes.h
  • ios646.h
  • limits.h
  • locale.h
  • math.h
  • setjmp.h
  • signal.h
  • stdalign.h
  • stdarg.h
  • stdatomic.h
  • stdbool.h
  • stddef.h
  • stdint.h
  • stdio.h
  • stdlib.h
  • stdnoreturn.h
  • string.h
  • tgmath.h
  • threads.h
  • time.h
  • uchar.h
  • wchar.h
  • wctype.h

C:Reserved Keywords

C Reserved Keywords

K&R C89
  • 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
C99 (addition)
  • _Bool
  • _Complex
  • _Imaginary
  • inline
  • restrict

C11 (addition)
  • _Alignas
  • _Atomic
  • _Generic
  • _Noreturn
  • _Static_asset
  • _Thread_local
  • alignof