delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/08/29/06:30:12

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Simple program. Strange results.
Date: 29 Aug 2003 10:14:22 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 29
Message-ID: <bin91u$2oj$1@nets3.rz.RWTH-Aachen.DE>
References: <HfZ2b.3213$cQ1 DOT 755278 AT kent DOT svc DOT tds DOT net> <hO%2b.16285$8i2 DOT 341 AT newsread2 DOT news DOT atl DOT earthlink DOT net> <tHc3b.3480$cQ1 DOT 829301 AT kent DOT svc DOT tds DOT net> <200308280125 DOT h7S1PFP5020856 AT envy DOT delorie DOT com> <bika4j$nbn$1 AT antares DOT lu DOT erisoft DOT se> <3F4E8FD4 DOT AD6096D8 AT phekda DOT freeserve DOT co DOT uk> <9by3b.3625$cQ1 DOT 943860 AT kent DOT svc DOT tds DOT net>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 1062152062 2835 137.226.32.75 (29 Aug 2003 10:14:22 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 29 Aug 2003 10:14:22 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Kenton W. Mellott <melken AT co DOT tds DOT net> wrote:

> Perhaps you can help me grasp the trouble I'm having understanding
> and using some previously suggested code.

Some of us could, but I think you really should find a better place
for this kind of questions.  There's a special newsgroup for beginners
learning C or C++ programming in the 'alt' hierarchy:
alt.comp.lang.learn.c-c++, which is much better suited to this kind of
question.

Or just get yourself a good textbook and learn it.

>      if ((nl = strchr(buf, '\n')))
> ->         *nl = 0;

> I read this as: if strchr makes nl anything but zero then make it
> equal to zero.

No.  Note how one assignment is made to 'n', the other to '*n'?  That
discinction is _important_.

> Why?  What other folloing statement uses it?
> Also, why us a pointer to  nl  used, instead of plain  nl.

It's not a 'pointer to nl'.  'nl' is a 'pointer to something'.
-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019