08/02/23 22:37:36
>>430
printf("%s",ch);をprintf("%s",x.st);とすればいい。
嫌か?
じゃあこれでどうだ。
#include <string.h>
#include <stdio.h>
typedef struct {
char *st;
} strdata;
void f(strdata *x) {
delete x->st;
x->st = new char[9];
strcpy(x->st,"++++++");
}
int main() {
char *ch = NULL;
strdata x;
x.st = ch;
f(&x);
ch = x.st;
printf("%s",ch);
delete[] ch;
return 0;
}