#include "stdio.h"
struct WORD1
{
char tag;
int size;

}WORD1;void main()
{

struct WORD1 *temp,foot;
*temp=foot;
foot.tag=0;
temp->tag=0;
}

解决方案 »

  1.   

    没有错呀
    只有两个警告
    foot没有初始化
    temp没有初始化
      

  2.   

    错误是使用未初始化的指针。好的编译系统会认为是错误。temp没初始化,就使用 *temp。
    应该是:
    temp=&foot;
      

  3.   

    struct WORD1
    {
    char tag;
    int size;

    }WORD1;
    第一个WORD1和第二个WORD1有没有重复!
    尝试把第二个WORD1改名看看.
      

  4.   

    你不觉得你的做法有点象:
    int int;
    吗?
      

  5.   

    你想干吗?是否想用foot初始化*temp? 如果是,则改成如下!如果不是,则你的temp仅仅没有分配实际内存(问题大了)!
    #include "stdio.h"
    struct WORD1
    {
    char tag;
    int size;

    }WORD1;void main()
    {

    struct WORD1 *temp,foot;
    temp=&foot;
    foot.tag=0;
    temp->tag=0;
    }
      

  6.   

    temp没有赋初值阿.系统应该会报错把?
      

  7.   

    struct WORD1 *temp,foot; *temp=foot;  ->指针怎么能 = 结构变量呢?
      

  8.   

    *temp=foot 的意思是temp所指向的结构体与结构体foot赋值。
      

  9.   

    但temp没有赋初值,会有非法内存访问错误。