joho07-1.ppt

Similar documents
II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D

超初心者用

void hash1_init(int *array) int i; for (i = 0; i < HASHSIZE; i++) array[i] = EMPTY; /* i EMPTY */ void hash1_insert(int *array, int n) if (n < 0 n >=


1.ppt

Microsoft Word - C.....u.K...doc

10

ohp03.dvi

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

PowerPoint プレゼンテーション

ex12.dvi

PowerPoint Presentation

PowerPoint プレゼンテーション - 物理学情報処理演習

‚æ4›ñ

r03.dvi

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n

tuat1.dvi

I ASCII ( ) NUL 16 DLE SP P p 1 SOH 17 DC1! 1 A Q a q STX 2 18 DC2 " 2 B R b

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( )

/ SCHEDULE /06/07(Tue) / Basic of Programming /06/09(Thu) / Fundamental structures /06/14(Tue) / Memory Management /06/1

(300, 150) 120 getchar() HgBox(x, y, w, h) (x, y), w, h #include <stdio.h> #include <handy.h> int main(void) { int i; double w, h; } HgO

(2 Linux Mozilla [ ] [ ] [ ] [ ] URL 2 qkc, nkc ~/.cshrc (emacs 2 set path=($path /usr/meiji/pub/linux/bin tcsh b

& & a a * * ptr p int a ; int *a ; int a ; int a int *a

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * *

‚æ2›ñ C„¾„ê‡Ìš|

02: 変数と標準入出力

2 P.S.P.T. P.S.P.T. wiki 26

/* sansu1.c */ #include <stdio.h> main() { int a, b, c; /* a, b, c */ a = 200; b = 1300; /* a 200 */ /* b 200 */ c = a + b; /* a b c */ }

ex01.dvi

C B

02: 変数と標準入出力

卒 業 研 究 報 告.PDF

02: 変数と標準入出力

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* (

Microsoft Word - Cプログラミング演習(12)

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou

I117 II I117 PROGRAMMING PRACTICE II 2 SOFTWARE DEVELOPMENT ENV. 2 Research Center for Advanced Computing Infrastructure (RCACI) / Yasuhiro Ohara yasu

新・明解C言語 ポインタ完全攻略

WinHPC ppt

02: 変数と標準入出力

ex14.dvi

r07.dvi

PowerPoint プレゼンテーション

ohp07.dvi

A/B (2018/06/08) Ver kurino/2018/soft/soft.html A/B

コマンドラインから受け取った文字列の大文字と小文字を変換するプログラムを作成せよ 入力は 1 バイトの表示文字とし アルファベット文字以外は変換しない 1. #include <stdio.h> 2. #include <ctype.h> /*troupper,islower,isupper,tol

:30 12:00 I. I VI II. III. IV. a d V. VI

:30 12:00 I. I VI II. III. IV. a d V. VI

随筆 私本太平記

±é½¬£²¡§£Í£Ð£É½éÊâ

XMPによる並列化実装2

program.dvi

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裵²ó ¨¡ À©¸æ¹½Â¤¡§¾ò·ïʬ´ô ¨¡

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 新装版 1 刷発行時のものです.

02: 変数と標準入出力

1-4 int a; std::cin >> a; std::cout << "a = " << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >>

C

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include

PowerPoint プレゼンテーション

(K&R 2.9) ~, &,, >>, << 2. (K&R 5.7) 3. (K&R 5.9) 4. (K&R 5.10) (argc argv atoi(), atof() ) 5. (K&R 7.5) (K&R 7.6) - FILE, stdin, stdout, std

ex01.dvi

johokiso-char.pdf.pdf

r08.dvi

1 CUI CUI CUI 1.1 cout cin redirect.cpp #i n c l u d e <s t r i n g > 3 using namespace std ; 5 6 i n t main ( void ) 7 { 8 s t r i n g s ; 10 c

橡Pro PDF

ポインタ変数

A/B (2010/10/08) Ver kurino/2010/soft/soft.html A/B

< F2D837C E95CF CF68A4A94C5816A2E6A>

第1回 プログラミング演習3 センサーアプリケーション

ohp08.dvi

Prog1_15th

( ) ( ) 30 ( ) 27 [1] p LIFO(last in first out, ) (push) (pup) 1

8 / 0 1 i++ i 1 i-- i C !!! C 2

C C UNIX C ( ) 4 1 HTML 1

C言語によるアルゴリズムとデータ構造

新・明解C言語 実践編

Microsoft PowerPoint - 10Com2.ppt

PowerPoint プレゼンテーション - 物理学情報処理演習

gengo1-12

C言語入門

: CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and Technology

P05.ppt

gengo1-12

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l

para02-2.dvi

comment.dvi

115 9 MPIBNCpack 9.1 BNCpack 1CPU X = , B =

double float

CM-3G 周辺モジュール拡張技術文書 MS5607センサ(温度、気圧)

file"a" file"b" fp = fopen("a", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen("b", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose

ポインタ変数

Cプログラミング1(再) 第2回

P06.ppt

I J

DKA ( 1) 1 n i=1 α i c n 1 = 0 ( 1) 2 n i 1 <i 2 α i1 α i2 c n 2 = 0 ( 1) 3 n i 1 <i 2 <i 3 α i1 α i2 α i3 c n 3 = 0. ( 1) n 1 n i 1 <i 2 < <i

AquesTalk for WinCE プログラミングガイド

第3回 配列とリスト

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

Transcription:

0xbffffc5c 0xbffffc60 xxxxxxxx xxxxxxxx 00001010 00000000 00000000 00000000 01100011 00000000 00000000 00000000 xxxxxxxx x y

2 func1 func2 double func1(double y) { y = y + 5.0; return y; } double func2(double* y) { (*y) = (*y) + 5.0; return *y; } int main(void) { double x = 10.1; /* print out x */ printf ( x: address [%p] value = %f n, &x, x); /* use func1 */ printf ( func1(x) = %f n, func1(x)); printf ( x: address [%p] value = %f n, &x, x); /* use func2 */ printf ( func2(x) = %f n, func2(&x)); printf ( x: address [%p] value = %f n, &x, x); return (0); }

Bit: 0 or 1 Byte: 8 bit 0 ~ 255 Word: 16 bit = 2 byte 0 ~ 65535 Long Word: 32 bit = 4 byte 0 ~ 4294967295

i int i; scanf( %d, &i); scanf %d &i scanf format ( ) int %d double %lf (lf char %c char* %s 4 scanf( %d, &i):400000100 scanf( %c, &c):00110100

32bit -2,147,483,658 ~ 2,147,483,657 0 ~ 4,294,967,295 10 16 2 256(=2 8 ) 0000 0000 0000 0000 0000 0000 0000 0001 0000 0000 0000 2 31-1 7FFF FFFF 0111 1111 1111 1111 1111 1111 1111 1111 1111-1 FFFF FFFF 1111 1111 1111 1111 1111 1111 1111 1111 1111-2 31 1000 0000 1000 0000 0000 0000 0000 0000 0000 0000 0000

s x M x B e-e s:x or - M: B:=2 e: E: E=151) s e M(23bits) 1.0 0 1000 0001 100 0000 0000 0000 0000 0000-0.5 1 1000 0000 100 0000 0000 0000 0000 0000 10-7 0 0011 1001 110 1011 0101 1111 1100 1010

ASCII A 0x41 1 0x31 CR() 0x0a Shift-JIS EUC UNICODE SJIS EUC UNICODE 0x905f 0xbfc0 0x795e 0x8ccb 0xb8cd 0x6238 0x8250 0xa3b1 0xff11

char array[128]; /* 128 */ moji1, moji2 char moji1, moji2; moji1 = array[0]; /* 0 */ moji2 = *array; /* */ moji1, moji2 char moji1, moji2; int i; moji1 = array[i]; /* i */ moji2 = *(array+1); /* i */

[ ] a[0]=0 void function(int a[]); int main(void) { int a[10]; a[0]=5; function(a); printf( a[0]=%d n,a[0]); return (0); } void function(int a[]) { a[0]=0; }

NN+1 NULL 0 const char* hello= HELLO! ; H E L L O! 0 address value &hello

#include <stdio.h> #include <string.h> void dumpstring(const char str[], int size); #define SIZE_S 8 int main(void) { const char* cs = Hello! ; cs char s1[size_s] = Ciao! ; s1 /* dump string of cs */ printf( cs = %s n, cs); dumpstring( cs, SIZE_S); /* dump string of s1 */ printf( s1 = %s n, s1); dumpstring( s1, SIZE_S); } return (0);

0x48 0x65 0x6c 0x6c 0x6f 0x20 0x21 0x00

<string.h>

strcat, strcpy const char* cs = HELLO const char* char s1[16]; strcpy(s1, cs); strcat(s1, ct); ct = WORLD! cs ct s s s strcpy(s, cs) strcat(s, ct)

char array[a_size][str_size] char array[a_size] char** array

char array[4][8] = { First, Second, Third, Last }; array[0] value array[0][0] array[0][1] array[0][2] array[0][3] array[0][4] array[0][5] array[1] array[2] array[3]

char* array[] = { First, Second, Third, Last }; address value array &array n0 array[0] array[1] array[2] array[3] n0 n0+off n0+2*off n0+3*off m1 m2 m3 m4 m1 m2 m3 m4

A) dumpstring7-2 #define SIZE_S 16 #define SIZE_A 4 int main(void) { char array[size_a][size_s] = { First, Second, Third, Last }; int i; /* dump string of s */ for (i=0; i<size_a; ++i){ printf( array[%d] = %s \n, i, array[i]); dumpstring( &(array[i][0]), SIZE_S); } return (0); }

B) dumpstring7-2 #define SIZE_S 16 #define SIZE_A 4 int main(void) { char* array[size_a] = { First, Second, Third, Last }; int i; /* dump string of s */ for (i=0; i<size_a; ++i){ printf( array[%d] = %s \n, i, array[i]); dumpstring( array[i], SIZE_S); } return (0); }

#include <stdio.h> int main(int argc, char* argv[]) { int i; } printf("argc= %d n",argc); for (i=0; i<argc; i++) { printf("argv[%d]= %s n", i, argv[i]); }