#include<stdio.h> int main() { printf("%x", -1<<1); getchar(); return 0; } | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

#include<stdio.h> int main() { printf("%x", -1<<1); getchar(); return 0; }

25th Dec 2018, 10:22 AM
Vinayak Irabatti
Vinayak Irabatti - avatar
8 Answers
+ 7
Who Do Better IT Ask the search bar.
25th Dec 2018, 6:43 PM
Babak
Babak - avatar
+ 7
Please could some one help me out with logs/codes/ procedures of how to make animations in C/C++😊
31st Dec 2018, 10:31 AM
OkomoJacob
OkomoJacob - avatar
+ 4
Arithmetic left shift ¹: shifting `-1` in two's complement ² representation to left by one as -1 << 1 At binary level (32-bit words) we have: 1 = 0000 0000 0000 0000 0000 0000 0000 0001 -1 = 1111 1111 1111 1111 1111 1111 1111 1111 and by doing 1111 1111 1111 1111 1111 1111 1111 1111 << 1 we get 1111 1111 1111 1111 1111 1111 1111 1110 = -2 in decimal And "%x" specifier would nicely format the hexadecimal representation of the above bit sequence [converts an unsigned integer into hexadecimal representation hhhh. ³]. Every 4 bits comprise one hex digit. So the total hex numbers are 8 as fffffffe or FFFFFFFE (for "%X") _____ ¹ https://en.wikipedia.org/wiki/Arithmetic_shift ² https://en.wikipedia.org/wiki/Two%27s_complement ³ https://en.cppreference.com/w/cpp/io/c/fprintf
25th Dec 2018, 5:33 PM
Babak
Babak - avatar
+ 3
Jamie💐 sorry
26th Dec 2018, 9:15 AM
Bilal Ahmed
Bilal Ahmed - avatar
+ 3
This is the most confusing post I have ever seen.
26th Dec 2018, 6:23 PM
Daniel Cooper
Daniel Cooper - avatar
+ 1
Tell me how I make a game in c++
25th Dec 2018, 6:28 PM
Bilal Ahmed
Bilal Ahmed - avatar
+ 1
You have to learn very much if you want to make game and it also take much time depend on quality and world.
26th Dec 2018, 1:34 AM
Abhishek Farshwan
Abhishek Farshwan - avatar
+ 1
fffffffe
26th Dec 2018, 2:33 PM
Abdul Rahman Khan
Abdul Rahman Khan - avatar