Way in over my head trying to pass a variable number of arguments ( pointers ) to a routine.

Arguments are passed in pairs, the variable type and then its address. When passing variables of type int things work, but byte and long types fail.



Usage

Code:
      byte TestByte = 10;
      va_func(1, 0, &TestByte); // Fails

      int TestInt = 20;
      va_func(1, 1, &TestInt); // Works

      long TestLong = 30;
      va_func(1, 2, &TestLong ); // Fails


Routine

Code:
      va_func(int ArgCount, ... ); 
      { 
        va_list Args;  

        va_start(Args, ArgCount);           

          for (int I = 0; I < ArgCount; I += 2)        
          { 
/*
*           Argument type
*/
            int VarType;
            VarType = va_arg(Args, int)
            printf("Type %d\n", VarType ); 
/*
*           Argument address
*/
            long VarAddress;
            VarAddress = va_arg(Args, int)
            printf("Address %d\n", VarAddress); 
/*
*           Argument Value
*/
            void *Ptr;
            Ptr = (void *)VarAddress;
            printf("Value %d\n", *Ptr);


            .....Code to process arguments goes here, returning a new value (NewValue) 

            *Ptr = NewValue;

          }

        va_end(Args);

      }