This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void TowersOfHanoi(); | |
int main() | |
{ | |
int n = 3; | |
char a = 'a'; | |
char b = 'b'; | |
char c = 'c'; | |
TowersOfHanoi(n, a, b, c); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int Print(); | |
int main() | |
{ | |
int p = 4; | |
printf("Value of Print: %d\n", Print(p)); | |
} | |
int Print(int n) { // 数を1からnまで後ろ向きに印刷する | |
if(n == 0) // これが終了ベースケース |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* WriteFile01.c */ | |
/* '0'から'9'までの10文字をファイル(WriteData.txt)に書き込む。 */ | |
#include <stdio.h> | |
int main(void) | |
{ | |
FILE *pFile = NULL; // ファイルポインタを定義 | |
char *pszInFileName = "WriteData.txt"; // 書き込みファイル名 | |
char *writeData = "0123456789"; // 書き込むデータとしての文字列 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* MemoryAlloc01.c */ | |
/* 動的に配列的なデータ域を確保する。 */ | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main(void) | |
{ | |
int *piData; | |
printf("int *piData; piDataのポインタ : %p\n", piData); //定義前のポインタの値を表示 | |
piData = NULL; //確保したメモリエリアのポインタを格納する変数と定義 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdbool.h> | |
#include "stack.h" | |
static bool isStackFull(const Stack *p) { | |
return p->top == p->size; | |
} | |
static bool isStackEmpty(const Stack *p) { | |
return p->top == 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdbool.h> | |
#include "stack.h" | |
int buf[16]; | |
int top = 0; | |
static bool isStackFull(void) { | |
return top == sizeof(buf) / sizeof(int); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/param.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
#include <sys/wait.h> | |
#include <arpa/inet.h> | |
#include <netinet/in.h> | |
#include <netdb.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROGRAM = client | |
OBJS = client.o | |
SRCS = $(OBJS:%.o=%.c) | |
CFLAGS = -g -Wall | |
LDFLAGS = | |
$(PROGRAM):$(OBJS) | |
$(CC) $(CFLAGS) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LDLIBS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
C言語のポインタのツボとコツがゼッタイにわかる本 | |
著者 石黒 尚久 | |
発行所 秀和システム | |
p47 | |
*/ | |
#include <stdio.h> | |
int main(void) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
//#define BIG_EXAMPLE | |
typedef struct node_t node_t, *heap_t; | |
typedef struct edge_t edge_t; | |
struct edge_t { | |
node_t *nd; /* target of this edge */ |