Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #102279

Re: Access structure members via pointer to an array of structures

From Manfred <noname@invalid.add>
Newsgroups comp.lang.c
Subject Re: Access structure members via pointer to an array of structures
Date 2017-01-21 17:15 +0100
Organization Aioe.org NNTP Server
Message-ID <o601e9$12p9$1@gioia.aioe.org> (permalink)
References <bfad510c-0f37-4e90-9482-4eb10f68fca3@googlegroups.com>

Show all headers | View raw


On 1/21/2017 11:00 AM, Alla _ wrote:
> Hello!
>
> Please, help me to find my mistake; it seems I do everything correctly
> but, most likely, I am mistaken.
<snip>
>
>         fprintf(stderr, "Loop beg: sales num %f; count %i\n", dat_years->sales, count);
>         fprintf(stderr, "Loop beg2: sales[%i] %f\n", count, dat_years[count].sales);
>
>         if (not_converted > ptr)
>         {
>             count++;
>             dat_years += (count != DATA_SIZE);
>             ptr = not_converted + (*not_converted != '\0');
>         }
<snip>
The first fprintf above uses dat_years that points to the correct array 
element.
The second fprintf uses dat_years[count] that does not refer to the 
correct element.
>
> Thank you!
>

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Access structure members via pointer to an array of structures Alla _ <modelling.data@gmail.com> - 2017-01-21 02:00 -0800
  Re: Access structure members via pointer to an array of structures Alla _ <modelling.data@gmail.com> - 2017-01-21 02:08 -0800
    Re: Access structure members via pointer to an array of structures Chad <cdalten@gmail.com> - 2017-01-21 07:36 -0800
      Re: Access structure members via pointer to an array of structures Jerry Stuckle <jstucklex@attglobal.net> - 2017-01-21 11:13 -0500
    Re: Access structure members via pointer to an array of structures Jerry Stuckle <jstucklex@attglobal.net> - 2017-01-21 11:08 -0500
      Re: Access structure members via pointer to an array of structures Chad <cdalten@gmail.com> - 2017-01-21 09:09 -0800
        Re: Access structure members via pointer to an array of structures Jerry Stuckle <jstucklex@attglobal.net> - 2017-01-21 14:32 -0500
          Re: Access structure members via pointer to an array of structures Chad <cdalten@gmail.com> - 2017-01-21 12:57 -0800
            Re: Access structure members via pointer to an array of structures Chad <cdalten@gmail.com> - 2017-01-21 13:04 -0800
              Re: Access structure members via pointer to an array of structures Jerry Stuckle <jstucklex@attglobal.net> - 2017-01-21 17:59 -0500
              Re: Access structure members via pointer to an array of structures cross@spitfire.i.gajendra.net (Dan Cross) - 2017-01-22 14:02 +0000
                Re: Access structure members via pointer to an array of structures raltbos@xs4all.nl (Richard Bos) - 2017-01-22 14:17 +0000
                Re: Access structure members via pointer to an array of structures Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-30 05:25 -0800
            Re: Access structure members via pointer to an array of structures Jerry Stuckle <jstucklex@attglobal.net> - 2017-01-21 17:57 -0500
  Re: Access structure members via pointer to an array of structures Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-01-21 08:09 -0800
    Re: Access structure members via pointer to an array of structures Keith Thompson <kst-u@mib.org> - 2017-01-21 15:15 -0800
      Re: Access structure members via pointer to an array of structures Gareth Owen <gwowen@gmail.com> - 2017-01-22 08:27 +0000
        Re: Access structure members via pointer to an array of structures Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-22 11:17 +0000
          Re: Access structure members via pointer to an array of structures BartC <bc@freeuk.com> - 2017-01-22 11:44 +0000
            Re: Access structure members via pointer to an array of structures Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-01-22 04:27 -0800
              Re: Access structure members via pointer to an array of structures Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-22 13:32 +0000
              Re: Access structure members via pointer to an array of structures Keith Thompson <kst-u@mib.org> - 2017-01-22 07:54 -0800
            Re: Access structure members via pointer to an array of structures Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-22 13:31 +0000
          Re: Access structure members via pointer to an array of structures Gareth Owen <gwowen@gmail.com> - 2017-01-22 14:02 +0000
        Re: Access structure members via pointer to an array of structures Keith Thompson <kst-u@mib.org> - 2017-01-22 07:50 -0800
  Re: Access structure members via pointer to an array of structures Manfred <noname@invalid.add> - 2017-01-21 17:15 +0100
  Re: Access structure members via pointer to an array of structures David Brown <david.brown@hesbynett.no> - 2017-01-21 17:59 +0100
    Re: Access structure members via pointer to an array of structures Alla _ <modelling.data@gmail.com> - 2017-01-21 09:09 -0800
      Re: Access structure members via pointer to an array of structures Barry Schwarz <schwarzb@dqel.com> - 2017-01-21 09:27 -0800
        Re: Access structure members via pointer to an array of structures Alla _ <modelling.data@gmail.com> - 2017-01-21 09:30 -0800
    Re: Access structure members via pointer to an array of structures Alla _ <modelling.data@gmail.com> - 2017-01-21 09:25 -0800
  Re: Access structure members via pointer to an array of structures "Peter \"Shaggy\" Haywood" <phaywood@alphalink.com.au> - 2017-01-30 22:04 +1100

csiph-web