1 / 5

情報処理演習 C2 ポインタ について

情報処理演習 C2 ポインタ について. メモリ. (?). (10). a. #include &lt;stdio.h&gt; int main() { int a; a = 10; double b; b = 20.0; printf(&quot;a = %d, b = %lf<br>&quot;,a,b); return 0; }. b. (?). (20.0). メモリ. #include &lt;stdio.h&gt; int func(int i1,int i2) { int i3 = i1+i2;

shae
Download Presentation

情報処理演習 C2 ポインタ について

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 情報処理演習C2ポインタについて

  2. メモリ (?) (10) a #include <stdio.h> int main() { int a; a = 10; double b; b = 20.0; printf("a = %d, b = %lf\n",a,b); return 0; } b (?) (20.0)

  3. メモリ #include <stdio.h> int func(int i1,int i2) { int i3 = i1+i2; return i3; } int main() { int a; a = 10; int b; b = func(a,20); printf("a = %d, b = %d\n",a,b); return 0; } a (10) (?) b (30) (?) (10) i1 (20) i2 (30) i3

  4. アドレス メモリ #include <stdio.h> int func(int* i1) { int i2 = 10+(*i1); (*i1) += 5; return i2; } int main() { int a = 10; int b; b = func(&a); printf("a = %d, b = %d\n",a,b); return 0; } (10) (15) a b (20) (?) (40) i1 (20) i2

  5. ポインタ変数 • int • 整数型:整数の数値を入れる。 • double • 浮動小数点型:実数の数値を入れる。 • int* • intのポインタ型:int変数のアドレスを入れる。 • double* • doubleのポインタ型:double変数のアドレスを入れる。

More Related