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


Groups > comp.lang.c > #107399

Re: singly linked list -- HCL interview question

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: singly linked list -- HCL interview question
Date Wed, 29 Mar 2017 08:46:07 -0700
Organization None to speak of
Lines 19
Message-ID <lno9wk3x34.fsf@kst-u.example.com> (permalink)
References <58d944cc$0$301$14726298@news.sunsite.dk> <aliidclgfna7s21craso25v0r08dvampto@4ax.com> <slrn3vfsodk247.98n.ike@iceland.freeshell.org> <58db38af$0$304$14726298@news.sunsite.dk>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info mx02.eternal-september.org; posting-host="91354899e69b8a2f4977e8b6ca3f6948"; logging-data="5309"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/awY7AlwOtsjycE9dhZdg0"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Cancel-Lock sha1:pxDFJF2I11TWLxvDPNXktYA82do= sha1:MBCW2yWGlTe5VLNXLjnLYvGKb7c=
Xref csiph.com comp.lang.c:107399

Show key headers only | View raw


arnuld <sunrise@invalid.address> writes:
>> On Tue, 28 Mar 2017 06:51:06 +0000, Ike Naar wrote:
>> It might be a better idea to keep createStack() and let it not only
>> allocate the memory, but also initialize the members,
>> setting 'head' to NULL and 'tn' to 0.
>> ('head' is now initialized in main(), 'tn' is never initialized, leading
>> to undefined behaviour in the functions that increment or decrement it).
>
> This idea was taught to me as a good coding practice by "The Other Keith" 
> @ http://www.ghoti.net/~kst 

FYI, that web page is out of date.  I just haven't bothered updating it
or my .signature.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

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


Thread

singly linked list -- HCL interview question arnuld <sunrise@invalid.address> - 2017-03-27 16:58 +0000
  Re: singly linked list -- HCL interview question Barry Schwarz <schwarzb@dqel.com> - 2017-03-27 11:08 -0700
    Re: singly linked list -- HCL interview question Chad <cdalten@gmail.com> - 2017-03-27 12:02 -0700
    Re: singly linked list -- HCL interview question arnuld <sunrise@invalid.address> - 2017-03-28 03:18 +0000
      Re: singly linked list -- HCL interview question Barry Schwarz <schwarzb@dqel.com> - 2017-03-27 22:59 -0700
        Re: singly linked list -- HCL interview question arnuld <sunrise@invalid.address> - 2017-03-29 04:28 +0000
      Re: singly linked list -- HCL interview question scott@slp53.sl.home (Scott Lurndal) - 2017-03-28 12:56 +0000
    Re: singly linked list -- HCL interview question Ike Naar <ike@iceland.freeshell.org> - 2017-03-28 06:51 +0000
      Re: singly linked list -- HCL interview question arnuld <sunrise@invalid.address> - 2017-03-29 04:31 +0000
        Re: singly linked list -- HCL interview question Keith Thompson <kst-u@mib.org> - 2017-03-29 08:46 -0700

csiph-web