#a doubt regarding signed and unsigned integers
62 messages Β· Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
The result is actually unsigned, but it is out of range of int so the return value is the int value with the same bit pattern, which is the correct result of the subtraction.
You can learn about two's complement, then you will know that subtracting signed integers is done the exact same way as unsigned.
oh thank you
does adding 'unsigned' before int main(), and calling a function inside it which is signed produce a different output?
What do you mean before int main()?
You cannot do that.
That wouldn't affect this thing anyway.
Also this is the C channel. C++ is over #1013107104678162544.
@stable hearth Has your question been resolved? If so, type !solved :)
Why you even want to use unsigned?
I was curious how it would affect the output
oh ok
Ah okay, and i would recommend also to look up how numbers work in computer systems. Its really interesting π pls dont forget to mark as solved.
Sometimes its also confusing, how numbers work xD
I got my scripts from university but there was a video from ben eater about this topic. I will look it up and send you the url
How can we represent negative numbers in binary? There are several ways. This video compares using a sign bit, ones complement, and twos complement. Twos complement is the most commonly technique because it's relatively easy to implement in hardware and it makes addition and subtraction with negative numbers easy.
Support me on Patreon: https:/...
Sometimes its also important how binary numbers work, and how to convert them to hex. You can convert a hex number (e.g. 0x24) in binary by just converting each number to binary -> 0010 0100
looks like ill be binging his playlists this weekend 
hmm i remember vaguely learning that in my 11th year
Im on it for 2 Semesters now and sometimes i still confused. There are things like overflow and carry. With you operation you got an overflow i think
ill be joining university in a month, so I would like to master cpp before thst!
No dont do that. Stay calm. Will be stressful enough π
And one month is no time at all π
yess the arithmetic overflow

Good luck with university π
welp fingers crossed i get to develop a tic tac toe project by then
thankyou for your help
Should be possible. But there are also classes, inhertance, polymorphism. And that takes time
np π
im currently learning from https://www.learncpp.com/
is this enough to achieve something akin to a mastery of the language?
I would focus some time on debugging. Is a nice skill, if something not work
C++ is hard. I think only after years you will master it. The best thing is practice
Im doing it for a year now and still cant do alot. To design the whole structure of a program is difficult. But you will get like instructions, so you can solve the assignments
But its normal to struggle π
ok noted
heres to a tough 4 years
one last question
what computer software and ide you you use?
I changed on my desktop to linux mint. I really like it so far. As IDE i use Clion. You can use the full version with your university mail address
Or VSCode is also often used. But i dont like it
ah the paid version
same, i find it too complex and cluttered as a beginner
Are you on Linux?
no, mac os
Np, just dm me for new further questions π
Then get Xcode.
yep, I already use it
Then keep using it.