2011-12-01から1ヶ月間の記事一覧

/

int main(){ //struct item linearList = {0, NULL}; //struct item linearList; //linearList.id = 0; //linearList.next = NULL; //struct item aa = {1, NULL}; //struct item aa; //aa.id = 1; //aa.next = NULL; item_t linearList; linearList.id = 0;…

構造体での中身代入時になぜかエラー

C++ C

#include typedef struct item{ int id; struct item * next; }item_t;void add(struct item * ori, struct item * tar); /* oh, my god, I spend 1 hours, why the hell, item_t linearList; linearList.id = 0; item_t aa; aa.id = 1; throws compile erro…

配列へのポインタ。char (*) [3] これー、意味分かる?

c++

char (*) [3]; これコンパイルとおります。char *x [3]; これの意味はcharへのポインタが3つからなる配列をつくる。じゃあこれは!? char (*x) [3]; これは、上とおなじじゃない!?違います。 これは char型が3つお要素からなる配列へのポインタです。ち…

メモリ空間のおさらい

1バイト(8ビット)ごとに番号(番地)が振られている。この番号を「アドレス」と呼び、一般に16進数で表記される。あたりまえのことだけど、番地って何バイトごとに割り当てられているんだっけ、と思ったので確認のために調べました。http://itpro.nikkeibp…