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


Groups > comp.lang.c > #107399

Re: singly linked list -- HCL interview question

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: singly linked list -- HCL interview question
Date 2017-03-29 08:46 -0700
Organization None to speak of
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>

Show all headers | 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