This file contains hidden or 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> | |
| struct List { | |
| int val; | |
| struct List* next; | |
| }; | |
| struct List* head; |
This file contains hidden or 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 func1(int &b) { | |
| b = 10; | |
| } | |
| int main() | |
| { | |
| int a = 50; | |
| func1(a); |
This file contains hidden or 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> | |
| int *func1() {//このような書き方はしてはならない。 aが保証されないため | |
| int a = 10; | |
| return &a; | |
| } | |
| int *func2() {//これはmallocで確保しているので自動変数の領域には入らない | |
| int *a = (int*)malloc(sizeof(int) * 10); |
This file contains hidden or 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 func1() { | |
| printf("関数func1が呼ばれました\n"); | |
| } | |
| void func2() { | |
| printf("関数func2が呼ばれました\n"); | |
| } |
This file contains hidden or 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[10]; //int型の配列10個分 a宣言 | |
| char* p; //char型ポインタp宣言 | |
| p = (char*)a; //a[0]のアドレスをpに格納 | |
| //forで0-9まで格納していく | |
| for (int i = 0; i < 10; i++) { |
This file contains hidden or 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 <malloc.h> | |
| int global; | |
| static int stglobal; | |
| void func1() { | |
| int local = 0; | |
| printf("ローカル変数func1=%p\n", (void*)&local); | |
| } |
This file contains hidden or 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[10]; //int型の配列10個分 a宣言 | |
| int b; //int型 b宣言 | |
| int *p; //int型ポインタp宣言 | |
| p = &b; //bのアドレスをpに格納 | |
| //forで0-9まで格納していく |
This file contains hidden or 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; //int型変数aを宣言 | |
| int* p; //int型のポインタpを宣言 | |
| p = &a; //aのアドレスをpに格納 | |
| a = 10; //aへ10を格納 | |
This file contains hidden or 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 jankenJudge(int p1, int p2) {//プレイヤーの手を引数に | |
| int judge;//返す為のjudgeを宣言 | |
| //勝ち負けの判定 | |
| if (p1 == p2) { | |
| judge = 3;//あいこの場合 | |
| } | |
| else { | |
| p1 = p1 % 3;//相手との差を求める |
This file contains hidden or 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 jankenJudge(int p1, int p2){//プレイヤーの手を引数に | |
| int judge;//返す為のjudgeを宣言 | |
| //勝ち負けの判定 | |
| if(p1 == p2){ | |
| judge = 3;//あいこの場合 | |
| }else{ | |
| p1 = p1 % 3;//相手との差を求める | |
| if(p1 + 1 == p2){ |
NewerOlder