周梦康 发表于 2019-07-11 865 次浏览 标签 : 未完成
typedef struct {
    char *host;
    char *ip;
} url;


int main(int argc, char *argv[]) {

    url *a;

    a = malloc(sizeof(url));

    a->host = (char *) malloc(sizeof(char));
    a->ip = (char *) malloc(sizeof(char));

    strcpy(a->host, "aaaa");
    strcpy(a->ip, "127.0.0.1");

    printf("%s\n", a->host);
    printf("%s\n", a->ip);

    return 0;
}

评论列表