flagflag  
9: 2012-02-19 (Sun) 06:41:41 s10037 source 10: 2012-02-22 (Wed) 19:19:25 s10037 source
Line 172: Line 172:
{~ {~
}~ }~
 +
 +**ポインタとconst [#b0e8c424]
 +***構造体 [#oba918ac]
 +構造体~
 +typedef struct dororo{~
 +   int hoge;~
 +   int tara;~
 +   int pong;~
 +}~
 +があるとして、
 +const dororo *a = (dororo*)malloc(sizeof(dororo) * i);~
 +という宣言をしてもメンバに値を代入できる~
 +dororoはポインタなのでconstがついていたら a=nanntyara みたいにポインタを変更することはできないが、a->hoge=100のような変更はおk
 +当然ではあるがconstは修飾した変数そのものにだけ有効である
 +
 +***javaの場合 [#vf68af87]
 +javaの場合も同様~
 +final hoge[5][5] = {
 +{1,2,3,4,5},
 +{1,2,3,4,5},
 +{1,2,3,4,5},
 +{1,2,3,4,5},
 +{1,2,3,4,5}
 +};
 +~
 +とあるとするとhogeは変更できないが、hoge[]とhoge[][]は弄る事ができる。~


Front page   New List of Pages Search Recent changes   Help   RSS of recent changes (RSS 1.0) RSS of recent changes (RSS 2.0) RSS of recent changes (RSS Atom)

Site Search

Login

Username:

Password:


Lost Password?
Register now!!

Sub Menu

mini Calendar

Last MonthMay 2024Next Month
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Today

Who's Online

25 user(s) are online (4 user(s) are browsing xpwiki)

Members: 0
Guests: 25

more...

Access Counter

Today : 1070107010701070
Yesterday : 4345434543454345
Total : 2365821123658211236582112365821123658211236582112365821123658211
Powered by XOOPS Cube 2.1© 2001-2006 XOOPS Cube Project
Design by XoopsDesign.com