can't assign value to struct variable

Help
steven
2008-11-21
2013-03-12
  • steven
    steven
    2008-11-21

    I can't assign one variable to another variable which has some struct type.

    example :
        typedef struct
        {
           int i;
           char c;
        } someStructType;

        someStructType struct1, struct2;
        void main
        {
          struct1.i = 1;
          struct1.c = 'a';
          strcut2 = struct1;   // can't pass compiler here
        }

    please help me, thank you!

     
    • Patryk
      Patryk
      2008-11-21

      Even if there have been:
      struct2 = struct1;
      instead of:
      strcut2 = struct1;
      SDCC cannot (yet) assign structures/unions, it's one of it's ANSI incompabilities (see sdccman.pdf, 8.2 ANSI-Compliance, p.97 in v2.8.0 Rev. 5096 2008-03-14).