Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: // at beginning of line |
| Date | 2011-06-02 13:13 -0700 |
| Organization | None to speak of |
| Message-ID | <ln7h94kn44.fsf@nuthaus.mib.org> (permalink) |
| References | <is64rm$qp7$1@speranza.aioe.org> <slrniud68l.31d.angel+news@pearlgates.net> <is68e9$51j$1@speranza.aioe.org> <lnr57dl1bt.fsf@nuthaus.mib.org> <is8ok7$te8$1@speranza.aioe.org> |
Federico <no.adress@nospam.com> writes:
> Keith Thompson writes:
>> Federico <no.adress@nospam.com> writes:
>>> Angel writes:
>>>> On 2011-06-01, Federico <no.adress@nospam.com> wrote:
>>>>> 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.
>>>>
>>>> That line is commented out. Everything after // up till the end of the
>>>> line is a comment.
>>>>
>>>> This construction comes from C++, but several compilers (like gcc)
>>>> made it available as an extension to C. In C99, this was made
>>>> official.
>>>
>>> Thank u. My compiler is for C not C++ and he gives an error of
>>> "unexpected token - missing semicolon?".
>>
>> It would have been *extremely* helpful if you had mentioned that in the
>> first place.
>>
>>> Would it be acceptable to replace with a normal comment /* ... */ ? Or
>>> even delete the line all in all ?
>>
>> Sure. Or find out how to get your C compiler (which one are you using?)
>> to recognize // comments.
>
> Thanks for ur help, now the program compiles fine.
>
> However when I run it I get this error :
> "PRGWMUPP caused a General Protection Fault in module <unknown>0417:1B6F.
> PRGWMUPP will close."
>
> I would like to change the source code to prevent this error, can anyone
> advice how to do it ? I think maybe I need a full C++ compiler not just
> basic C, would you agree ?
Please don't top-post. See:
http://www.caliburn.nl/topposting.html
http://www.cpax.org.uk/prg/writings/topposting.php
and almost every other followup in this newsgroup.
(And silly abbreviations like "u" for "you" are not helpful.
I understand they're popular in some places, like text messages;
this is not one of those places.)
You've shown us two lines of code, one of them a comment. We don't
have anything like enough information to guess what might be causing
your program to crash. I wouldn't think that changing from C to C++
would make any difference. Remember that C and C++ are two different
(but closely related) languages.
More suggested reading:
http://www.catb.org/~esr/faqs/smart-questions.html
--
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
// 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