 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Markus Moll Guest
|
Posted: Sat Mar 10, 2007 6:48 pm Post subject: Re: Switch syntax error- |
|
|
Hi
Lumina wrote:
| Quote: | char ch ;
return 0;
}// main
|
Function "main" ends here.
| Quote: |
//Statements *
switch ( count)
{
case 'E': count
|
You cannot have statements outside functions.
Markus
--
comp.lang.c.moderated - moderation address: clcm (AT) plethora (DOT) net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry. |
|
| Back to top |
|
 |
Keith Thompson Guest
|
Posted: Tue Mar 13, 2007 3:02 am Post subject: Re: Switch syntax error- |
|
|
"Michael Tiomkin" <tmk (AT) netvision (DOT) net.il> writes:
| Quote: | On Mar 5, 10:43 pm, "Lumina" <tinalsmit...@hotmail.com> wrote:
I need some assistance on getting past C2059 sytax
You don't mention what compiler you use. Every compiler has its own
error codes.
|
To be clear, you don't *need* to tell us what compiler you use, at
least not for the problem you're having here. Just show us the error
message. It's enough to know that the compiler reported a syntax
error; don't expect anyone to know or care what C2059 means.
And it's helpful to copy-and-paste the *exact* error message rather
than to try to paraphrase it. (For example, I'm sure it said
"syntax", not "sytax".)
[...]
| Quote: | Please move the next statement after the end of your switch
statement. In some languages, e.g. Assembler, you are allowed
to insert code outside of the functions. Unfortunately,
in C/C++ you can only put data declarations/definitions
outside of the functions.
|
I see nothing unfortunate about that.
To the original poster: the comp.lang.c.moderated newsgroup has a
pretty good signal-to-noise ratio, but it's slow, because every
article has to wait to be approved by the moderator. I think the
problem you're having is going to require a lot of of back-and-forth
discussion, not just a single question and answer. You might have
better luck in comp.lang.c.
But the nature of the errors you're making suggests that you're going
about this the wrong way, trying to do things before you understand
what you're doing. Get yourself a good book or tutorial, and study
it. Beware that there are a lot of *bad* books and tutorials out
there. K&R2 (Kernighan & Ritchie, _The C Programming Language_, 2nd
Edition) is excellent. The comp.lang.c FAQ, <http://www.c-faq.com/>
and the clc-wiki <http://www.clc-wiki.net/wiki/Main_Page>, are also
good resources.
--
Keith Thompson (The_Other_Keith) kst-u (AT) mib (DOT) org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
--
comp.lang.c.moderated - moderation address: clcm (AT) plethora (DOT) net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry. |
|
| Back to top |
|
 |
Powered by phpBB © 2001, 2006 phpBB Group
|