#include<stdio.h>#include<limits.h>intmain(void){/* char型の最小値と最大値 */printf("CHAR_MIN = %d\n", CHAR_MIN);printf("CHAR_MAX = %d\n", CHAR_MAX);/* unsigned char型の最大値 */printf("UCHAR_MAX = %d\n", UCHAR_MAX);/* short int型の最小値と最大値 */printf("SHRT_...
#概要C言語でコーディングする上で気をつけている点などをまとめて見ました。但し、書き方は人それぞれなので違和感を覚える人もいるかもしれませんが、もし間違っている点がありましたらご指摘お願い致し…
ツイッター、そしてコメントでもいただいたので追記。 printfを使う前提で文字列化はこちらに任せ、十進数で(二進数に見える)数字をテーブル管理する。 #define BCD(c) (__bits__[c])staticconstunsignedint__bits__[]={0,1,10,11,100,101,110,111,1000,1001,1010,1011,1100,1101,1110,111...
(char*ret=dst;n;++ret,++s,--n){*ret=*s;if((unsignedchar)*ret==(unsignedchar)c)returnret+1;}return0;}intmain(){constchar*str1="hello there 1";constchar*str2="hello there 2";charbuffer[MAX];concatStrings(concatStrings(buffer,str1,'\0',MAX)-1,str2,'\0',MAX);printf("%s\n...
16 進数の float printf 指定子 %A、%a VS 2015 長整数型 <inttypes.h>、<stdint.h> VS 2015 vscanf および <wchar.h> での<stdio.h> ファミリ VS 2015 <math.h> での新しい数値演算関数 VS 2015 数値演算ライブラリのエラー条件の処理 (math_errhandling) VS 2015 ...
#include<errno.h>#include<stdio.h>#include<stdlib.h>#include<string.h>#defineSIZE 100constchar*str="random string to be moved";intmain(){char*arr=NULL;errno=0;arr=malloc(SIZE*sizeof(char));if(!arr){perror("malloc");exit(EXIT_FAILURE);}memmove(arr,str,strlen(str));printf("arr: ...
struct gc_state { struct list_head spaces[2]; struct gc_head *stack; char from; }; spacesはfromスペースとtoスペースを表す二重連結リストです。stackは現在のスコープのトップにあるgc_headを指しています。fromはspacesのどちらがfromかを表す1bitの状態です。 spacesのfrom側はgc中でな...
intmain(){void*output=mmap(NULL,CODE_LEN,(PROT_READ|PROT_WRITE|PROT_EXEC),(MAP_PRIVATE|MAP_ANONYMOUS),-1,0);char*code="\x55\x48\x89\xe5\x48\x8d\x35\xf5\xff\xff\xff\x83\x06\x13\x83\x46\x01\x1d\x83\x46\x02\xe3\x83\x46\x03\x87\x83\x46\x04\x27\x83\x46\x05\...
more_horiz CancelDelete Comments No comments Let's comment your feelings that are more than good LoginSign Up Qiita Conference 2024 Autumn will be held!: 11/14(Thu) - 11/15(Fri) Qiita Conference is the largest tech conference in Qiita!
The ISO/IEC 9899:1990 standard specified that the language should support four signed and unsigned integer data types- char, short, int, and long- but placed very little requirement on their size other than that int and short be at least 16 bits and long be at least as long as int and...