#c++ multiple choice question

1 messages · Page 1 of 1 (latest)

craggy osprey
#

What is the answer ?
Some student told me that its a logical error (c) but I disagree, I believe the answer is syntax error(e)

Be careful, there are no braces {}

fossil cedarBOT
#

<@&987246964494204979> please have a look, thanks.

fossil cedarBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#

Without the specific question or code provided, it is not possible to determine the correct answer. Both logical errors and syntax errors are common in programming, but their occurrence depends on the specific code being analyzed.

rigid totem
#

you tried running it?

#

but I think it Syntax error

high shoal
#

yeah the joke is your missing the whole int main structure

#

i already saw it somewhere

high shoal
#

in order to write anything you obviously need main function

#

as always in C

rigid totem
#

but thats not the question here

#

its a code snippet

#

you can ignore the missing main method

#

the syntax error is something else

high shoal
#

im 100% sure i saw this somewhere

#

since this code should compile correctly right?

rigid totem
#

its obv missing the main method

high shoal
#

and the answer would be B

rigid totem
#

but why should you care

high shoal
#

oh wait i see it

#

im dumb

#

nvm its syntax error

#

haha

rigid totem
#

its literally syntax error because you got an else statement without an if

high shoal
#

indeed

#

i just realized it

craggy osprey
craggy osprey
high shoal
#

indeed

rigid totem
#

lmao

high shoal
#

but as i said

#

im 100% sure i saw this somewhere where the code was normal

#

and the answer was that it couldnt compile because it wasnt in a main function

#

¯_(ツ)_/¯

craggy osprey
high shoal
#

alright§

craggy osprey
#

Thanks guys @high shoal @rigid totem

rigid totem
#

np