【初心者歓迎】C/C++室 Ver.49【環境依存OK】at TECH
【初心者歓迎】C/C++室 Ver.49【環境依存OK】 - 暇つぶし2ch484:デフォルトの名無しさん
08/02/24 00:18:48
>>479
それだと、 bin x;を初期化する関数と、適当な配列を入れるとバグるんです なんでうごかないんですか

#include <stdio.h>
#include <string.h>
typedef struct { char **start ; char **end; } bin;

void f(bin *x) {
delete[] *x->start;
*x->start = new char [3];
strcpy(*x->start,"aa"); }

void h(bin *x){
char *ch=new char [3];
ch[0]='X';ch[1]=0;
x->start=&ch; }

main() {
bin x;
h(&x);
f(&x);
char *test=new char [1];
printf("%s",*(x.start));
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch