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 main() | |
{ | |
int i; | |
for (i = 0; i < 10; i++) // 10回繰り返す | |
{ | |
printf("Hello, world!\n"); // 文字列を出力する | |
} | |
return 0; // プログラムが問題なく終了したことをOSに知らせる |
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 main() | |
{ | |
char str_a[20]; | |
str_a[0] = 'H'; | |
str_a[1] = 'e'; | |
str_a[2] = 'l'; | |
str_a[3] = 'l'; | |
str_a[4] = 'o'; | |
str_a[5] = ','; |
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 <string.h> | |
int main() { | |
char str_a[20]; | |
strcpy(str_a, "Hello, world!\n"); | |
printf(str_a); | |
} |
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 main() { | |
printf("The 'int' data type is\t\t %d bytes\n", sizeof(int)); | |
printf("The 'unsigned int' data type is\t %d bytes\n", sizeof(unsigned int)); | |
printf("The 'short int' data type is\t %d bytes\n", sizeof(short int)); | |
printf("The 'long int' data type is\t %d bytes\n", sizeof(long int)); | |
printf("The 'long long int' data type is %d bytes\n", sizeof(long long int)); | |
printf("The 'float' data type is\t %d bytes\n", sizeof(float)); | |
printf("The 'char' data type is\t\t %d bytes\n", sizeof(char)); |
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 <string.h> | |
int main() { | |
char str_a[20]; // 20個の要素を持つ文字の配列 | |
char *pointer; // 文字の配列を指すポインタ | |
char *pointer2; // 同じく、文字の配列を指すポインタ | |
strcpy(str_a, "Hello, world!\n"); | |
pointer = str_a; // 1つ目のポインタが配列の戦闘を指すように設定する |
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 main() { | |
int int_var = 5; | |
int *int_ptr; | |
int_ptr = &int_var; // int_varのアドレスをint_ptrに設定する | |
} | |
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 main(){ | |
int int_var = 5; | |
int *int_ptr; | |
int_ptr = &int_var; // int_varのアドレスをint_ptrに設定する | |
printf("int_ptr = 0x%08x\n", int_ptr); | |
printf("&int_ptr = 0x%08x\n", &int_ptr); |
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 <string.h> | |
int main() { | |
char string[10]; | |
int A = -73; | |
unsigned int B = 31337; | |
strcpy(string, "sample"); |
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 <string.h> | |
int main() { | |
char message[20]; | |
int count, i; | |
strcpy(message, "Hello, world!"); | |
printf("何度繰り返しますか?"); |
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 main(){ | |
int a, b; | |
float c, d; | |
a = 13; | |
b = 5; | |
c = a / b; // 整数による除算 | |
d = (float) a / (float) b; // 整数を浮動小数点にキャストした後の除算 |
OlderNewer