From: "Michal Nazarewicz" <mina86@mina86.com>
To: linux-c-programming <linux-c-programming@vger.kernel.org>,
Vadiraj <vadiraj.cs@gmail.com>
Subject: Re: initializing a struct
Date: Thu, 30 Jun 2011 13:03:26 +0200 [thread overview]
Message-ID: <op.vxvyb01k3l0zgt@mnazarewicz-glaptop> (raw)
In-Reply-To: <BANLkTikvCRn1mdCosk=-Bm8EqDamE5FtpQ@mail.gmail.com>
On Thu, 30 Jun 2011 12:18:25 +0200, Vadiraj <vadiraj.cs@gmail.com> wrote:
> I'm stuck with logical reason for initializing a struct variable. Please
> help..
> Consider a struct defined this way..
> struct foo {
> int a;
> char *ptr;
> };
> in my function I declare a local variable of this struct.
> void bar()
> {
> struct foo local_var[10];
> ...
> ...
> }
> do you suspect a initialization issue? do we need to initialize the
> local array local_var[10] ?
Yes. The array has random data.
> What's the best practice?
Uh? Initialise it if you need.
--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +-----<email/xmpp: mnazarewicz@google.com>-----ooO--(_)--Ooo--
next prev parent reply other threads:[~2011-06-30 11:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <BANLkTimgJN2_SH+_mvkckZKBefCLN6aM=g@mail.gmail.com>
2011-06-30 10:18 ` initializing a struct Vadiraj
2011-06-30 11:03 ` Michal Nazarewicz [this message]
2011-07-01 17:58 ` Davidlohr Bueso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=op.vxvyb01k3l0zgt@mnazarewicz-glaptop \
--to=mina86@mina86.com \
--cc=linux-c-programming@vger.kernel.org \
--cc=vadiraj.cs@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox