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


Groups > comp.lang.c > #5228

Re: // at beginning of line

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: // at beginning of line
Date 2011-06-01 12:56 -0700
Organization None to speak of
Message-ID <lnzkm1l3zz.fsf@nuthaus.mib.org> (permalink)
References <is64rm$qp7$1@speranza.aioe.org>

Show all headers | View raw


Federico <no.adress@nospam.com> writes:
> Hello. I'd like to understand the following piece of source:
>
> .........
>
> fscanf ( Infile, "%3s %6s", string1, string2);
> //fscanf(Infile,"%5s %5s",string3,string4);
>
> ^^--------- I don't know the meaning of this double slash.

It introduces a comment, which extends from the "//" to the end of
the line.

It's one of two forms of comments supported by C.  The other is
introduced by "/*" and terminated by "*/".  (There's more to it
than that, but I won't get into the gory details.)

Note that the C90 standard didn't support "//" comments, only
"/* ... */" comments.  C99 introduced "//" comments (borrowed
from C++, and ultimately from BCPL).  So your C compiler might not
recognize "//" comments, or might require some option to cause it
to recognize them.  (I think most modern C compilers do recognize
"//" comments by default.)

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Nokia
"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 | Next in thread | Find similar | Unroll thread


Thread

// at beginning of line Federico <no.adress@nospam.com> - 2011-06-01 19:44 +0000
  Re: // at beginning of line Ben Pfaff <blp@cs.stanford.edu> - 2011-06-01 12:48 -0700
  Re: // at beginning of line Angel <angel+news@spamcop.net> - 2011-06-01 19:55 +0000
    Re: // at beginning of line Federico <no.adress@nospam.com> - 2011-06-01 20:46 +0000
      Re: // at beginning of line Keith Thompson <kst-u@mib.org> - 2011-06-01 13:54 -0700
        Re: // at beginning of line Federico <no.adress@nospam.com> - 2011-06-02 19:34 +0000
          Re: // at beginning of line Ben Pfaff <blp@cs.stanford.edu> - 2011-06-02 12:38 -0700
          Re: // at beginning of line Keith Thompson <kst-u@mib.org> - 2011-06-02 13:13 -0700
      Re: // at beginning of line Angel <angel+news@spamcop.net> - 2011-06-01 20:59 +0000
  Re: // at beginning of line Keith Thompson <kst-u@mib.org> - 2011-06-01 12:56 -0700
    Re: // at beginning of line Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-06-01 23:06 -0700
      Re: // at beginning of line Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-06-02 07:15 +0000
        Re: // at beginning of line Chris H <chris@phaedsys.org> - 2011-06-02 08:40 +0100
          Re: // at beginning of line James Kuyper <jameskuyper@verizon.net> - 2011-06-02 06:15 -0400
            Re: // at beginning of line Chris H <chris@phaedsys.org> - 2011-06-02 11:35 +0100
              Re: // at beginning of line James Kuyper <jameskuyper@verizon.net> - 2011-06-02 07:58 -0400
              Re: // at beginning of line Lorenzo Villari <vlllnz@tiscali.it> - 2011-06-02 15:18 +0200
                Re: // at beginning of line Chris H <chris@phaedsys.org> - 2011-06-02 14:59 +0100
              Re: // at beginning of line Ian Collins <ian-news@hotmail.com> - 2011-06-03 09:09 +1200
                Re: // at beginning of line Chris H <chris@phaedsys.org> - 2011-06-03 09:40 +0100
                Re: // at beginning of line Ian Collins <ian-news@hotmail.com> - 2011-06-03 20:51 +1200
                Re: // at beginning of line James Kuyper <jameskuyper@verizon.net> - 2011-06-03 06:57 -0400
                Re: // at beginning of line Nobody <nobody@nowhere.com> - 2011-06-03 12:54 +0100
                Re: // at beginning of line Chris H <chris@phaedsys.org> - 2011-06-03 13:27 +0100
                Re: // at beginning of line Keith Thompson <kst-u@mib.org> - 2011-06-03 09:42 -0700
                Re: // at beginning of line Chris H <chris@phaedsys.org> - 2011-06-05 17:27 +0100
                Re: // at beginning of line Keith Thompson <kst-u@mib.org> - 2011-06-05 12:35 -0700
                Re: // at beginning of line Chris H <chris@phaedsys.org> - 2011-06-06 09:27 +0100
                Re: // at beginning of line Keith Thompson <kst-u@mib.org> - 2011-06-06 09:29 -0700
                Re: // at beginning of line Roberto Waltman <usenet@rwaltman.com> - 2011-06-06 14:37 -0400
                Re: // at beginning of line Nobody <nobody@nowhere.com> - 2011-06-03 23:16 +0100
                Re: // at beginning of line Chris H <chris@phaedsys.org> - 2011-06-05 17:28 +0100
                Re: // at beginning of line Nobody <nobody@nowhere.com> - 2011-06-06 22:39 +0100
  Re: // at beginning of line Shao Miller <sha0.miller@gmail.com> - 2011-06-01 23:05 -0500
  Re: // at beginning of line Datesfat Chicks <datesfat.chicks@gmail.com> - 2011-06-02 13:34 -0400

csiph-web