Help me pass my exam tomorrow=D

I've got an exam tomorrow partly on Arduino, and part(b) is the last question I don't understand.
I think it is something to with the return function but I cannot figure out why it returns a negative number.
Can anyone help me?
(This is just revision btw)

Put yourself in my place, trying to read that on my phone.

return is not a function.

1 Like

So you want the forum to tell you the answer in an exam ?

Whats the point of the exam if other people tell you the answers ?

1 Like

Which "Arduino"?

How come you already have the exam paper complete with the answers ?

Wait . . . what?

"NUMBAS" - is that indicative?
Or a typo?

Come back after exam, I’ll explain

This is just a practice test

Hint: the value is negative because of 16bits integer overflow

I'm overflowing with the urge to help... But it's not my test.

Hi,
Calculate answer using the values given.

The answer is an "int".
Check what the maximum and minimum values of an "int".

Tom.... :grinning: :+1: :coffee: :australia:

Is there medical forum where doctors go?
— Colleagues, help me with heart operation tomorrow, I’m not sure where to start=D

2 Likes

Where does it state it's an eight-bitter?
It could be a Due.

ahhh thank you so much

But it is said the "correct" result is -8711 so the size of int can be guessed from that :wink:

It's not readable on a desktop either.

Well, it does state at the bottom (after blowing the image up enough to actually be able to read it) "The return type for the function is an integer and so your answers must fall within the acceptable value range for this data type. See Arduino tutorial notes for more details on this." Not much we can add to that.

Hello
Take an Arduino, code it and you will see the "answer".
Have a nice day and enjoy coding in C++.

The "long" data type is an integer, as is a "char"
I imagine they meant "int", but the size of that is platform-dependent.
I think a B- for the setter of the "exam"

Probably never got over UNO