当前位置:编程学习 > C/C++ >>

c++ struct 定义后的变量显示 null

#include "stdafx.h" #include<stdio.h> #include<windows.h> struct node { char *data; }q; DWORD WINAPI mythread(void *s) { printf("%s\n",q.data);//为什么显示为null return 0; } int main(int argc, char* argv[]) { if(argc<2) {return 0;} HANDLE handle; char * s = argv[2]; s = q.data;//有赋值 handle=CreateThread(NULL,0,mythread,NULL,0,NULL); Sleep(1000); CloseHandle(handle); return 0; } 参数为x s 显示结果为 (null) 不是应该为 s 吗?
追问:s = q.data; 这段不算是赋值吗?有些 复杂话说 朋友这个 要怎么改
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,