(旧)研究メモ

kennkyuumemo

2014-05-15から1日間の記事一覧

malloc

#include<stdlib.h> void* malloc(size_t size); void* はとりあえずの型、使うときに具合的な型を入れる size_t sizeはsizeof()つかえばいい100byteのint型の領域を確保したいとき int*n; n = (int*)malloc(sizeof(int)*50); とか終わったらfree(n)で開放する</stdlib.h>

構造体

struct 構造体タグ名 {メンバたち}; struct 構造体タグ名 構造体変数名; 例 struct date { int year; int month; int day; }; struct date d = {2014, 5, 15}; cout << "Today is "d.year << "/" << d.month << "/" << d.day << endl; 出力は Today is 2014/…