[comp.lang.c] address problems

mgf@Neon.Stanford.EDU (Michael G. Fitzpatrick) (06/13/90)

  I am at a lost with a function's argument passing.  The following
is a segment from my code...

  void GetDataRange (string_range)
  char  *string_range;

  {

    short  *get_range();

    short  *vector_list;
    short   vector_length;

    vector_list = get_range (&vector_length, string_range);

                .
                .
                .



 where string_range was passed to this code and get_range is a function that
returns the length of the specified string_range into vector_length and an
array of its values into vector_list.  vector_length is at address 0xf7fffae2, 
and string_range is at address 0xf7fffb6c.  The get_range routine begins like
this...


    short *get_range (vector_length, string_length)
    short  *vector_length;
    char   *string_length;

    {
          .
          .
          .

 However, within the get_range function, vector_length is now at address
0xf7fffb1a and string_length is at address 0xf7fffaa8.  Thus my pass by
reference is getting the wrong addresses.  Upon returning from the get_range
function, the vector_length and vector_list variables within the GetDataRange
function contain garbage.  First, has anyone ever experienced anything like
this before and secondly does anyone have any clue what might be
causing it.  I have tried everything I know of to find the problem but
hopefully someone out there can recommend a couple of other things. I am
working on a SUN 4/150 with SUNOS4.0 and compiled the file as "cc -g".  

   Thanks,   Mike Fitzpatrick  (mgf@neon.stanford.edu)