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


Groups > comp.lang.c > #42835

Re: dereferencing problem

From "Bill Cunningham" <nospam@nspam.invalid>
Newsgroups comp.lang.c
Subject Re: dereferencing problem
Date 2014-04-12 19:57 -0400
Organization A noiseless patient Spider
Message-ID <licjss$n80$1@dont-email.me> (permalink)
References <licdpj$k7j$1@dont-email.me> <licf4i$svt$1@dont-email.me> <pa-20140413004448@ram.dialup.fu-berlin.de> <licgaq$4k8$1@dont-email.me> <lichga$o4k$1@speranza.aioe.org>

Show all headers | View raw


glen herrmannsfeldt wrote:
> Bill Cunningham <nospam@nspam.invalid> wrote:
>
> (snip, and previously snipped code using pa)
>
>> struct addrinfo *pa;
>
>> A pointer to a struct addrinfo type. Is my syntax wrong?
>
> Syntax is right. That declares pa as a pointer, but doesn't
> point it to anything.
>
> One way is to have a struct addrinfo, and use &.
>
> struct addrinfo a;
> struct addrinfo *pa=&a;
> (or assign it on another line)
>
> Since addrinfo is small, that is probably the best way,
> but some will malloc() it.
>
> struct addrinfo *pa;
> pa=malloc(sizeof(*pa));
>
> then you should remember to free() it later.
[snip]

Or use memset! Like memset (pa,0,sizeof (struct addrinfo)); Since it takes a 
pointer. Or maybe I should use memset(&pa,0,sizeof(struct addrinfo));
Which would I use and why?

Bill

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


Thread

dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 18:13 -0400
  Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 18:36 -0400
    Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 18:56 -0400
      Re: dereferencing problem glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-04-12 23:16 +0000
        Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 19:52 -0400
        Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 19:57 -0400
          Re: dereferencing problem Barry Schwarz <schwarzb@dqel.com> - 2014-04-13 01:00 -0700
        Re: dereferencing problem Les Cargill <lcargill99@comcast.com> - 2014-04-14 01:10 -0500
          Re: dereferencing problem glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-04-14 06:50 +0000
            Re: dereferencing problem Les Cargill <lcargill99@comcast.com> - 2014-04-14 07:42 -0500
            Re: dereferencing problem "Charles Richmond" <numerist@aquaporin4.com> - 2014-04-14 14:36 -0500
              Re: dereferencing problem glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-04-14 20:10 +0000
    Re: dereferencing problem Barry Schwarz <schwarzb@dqel.com> - 2014-04-12 16:50 -0700
      Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 20:12 -0400
        Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 20:30 -0400
          Re: dereferencing problem Richard Damon <Richard@Damon-Family.org> - 2014-04-12 20:39 -0400
            Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 21:01 -0400
              Re: dereferencing problem Ian Collins <ian-news@hotmail.com> - 2014-04-13 13:02 +1200
          Re: dereferencing problem Ian Collins <ian-news@hotmail.com> - 2014-04-13 12:53 +1200
          Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 20:58 -0400
            Re: dereferencing problem Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-04-12 21:04 -0400
          Re: dereferencing problem Barry Schwarz <schwarzb@dqel.com> - 2014-04-13 01:13 -0700
            Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-13 12:54 -0400
              Re: dereferencing problem Barry Schwarz <schwarzb@dqel.com> - 2014-04-13 14:14 -0700
        Re: dereferencing problem Barry Schwarz <schwarzb@dqel.com> - 2014-04-13 01:12 -0700
          Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-13 12:57 -0400
            Re: dereferencing problem Barry Schwarz <schwarzb@dqel.com> - 2014-04-13 14:22 -0700
            Re: dereferencing problem glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-04-13 22:18 +0000
    Re: dereferencing problem Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-04-12 21:02 -0400
      Re: dereferencing problem Ian Collins <ian-news@hotmail.com> - 2014-04-13 13:03 +1200
        Re: dereferencing problem Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-04-12 21:07 -0400
      Re: dereferencing problem glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-04-13 01:18 +0000
        Re: dereferencing problem Ian Collins <ian-news@hotmail.com> - 2014-04-13 13:19 +1200
      Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-12 21:25 -0400
        Re: dereferencing problem Ian Collins <ian-news@hotmail.com> - 2014-04-13 13:30 +1200
        Re: dereferencing problem Barry Schwarz <schwarzb@dqel.com> - 2014-04-13 01:18 -0700
          Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-13 12:50 -0400
            Re: dereferencing problem Barry Schwarz <schwarzb@dqel.com> - 2014-04-13 14:24 -0700
              Re: dereferencing problem "Osmium" <r124c4u102@comcast.net> - 2014-04-13 18:48 -0500
              Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-14 14:46 -0400
                Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-14 15:58 -0400
                Re: dereferencing problem "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-14 16:08 -0400
        Re: dereferencing problem Herbert Rosenau <os2guy@pc-rosenau.de> - 2014-05-03 14:19 +0200
          Re: dereferencing problem "Bill Cunningaham" <nospam@nspam.invalid> - 2014-05-03 11:29 -0400
            Re: dereferencing problem "Bill Cunningaham" <nospam@nspam.invalid> - 2014-05-03 11:42 -0400
          Re: dereferencing problem Richard <rgrdev_@gmail.com> - 2014-05-03 21:15 +0200
  Re: dereferencing problem Ian Collins <ian-news@hotmail.com> - 2014-04-13 11:15 +1200

csiph-web