Serenity
Anonymous
Anonymous
You can solve this a lot more easily
Serenity
What's I'm focusing now is getting a proper binary number , manipulating it is quite easy.
Anonymous
Use strtoll
Anonymous
And check errno before and after
Anonymous
As per the question you don't need to bother yourself with the actual conversion
Anonymous
Or strtoul()
Anonymous
The last arguement becomes 2 instead of 10
Anonymous
For bits you can easily fit into an unsigned integer
Serenity
I'll tell you what, the entire exercise is about bit manipulation. So I am afraid that I do it in a method that doesn't involve working with bits , the solution won't be admissible.
Anonymous
Serenity
In general the string has to be passed to a function and the conversion should be done there
Anonymous
As a debug please print the string as well as the length
Serenity
an integer, not the string.
Anonymous
Serenity
I have to take in a string in the main function, convert it to an integer type and then pass it to a function.
Anonymous
Just run strlen(str) and print it as a debug
Serenity
Yes I can change it .
Serenity
ok
Serenity
Serenity
So what am I doing with strtoll ?
Serenity
I realized what the problem was
Serenity
I forgot to add <stdlib.h> in the beginning.
Vamsi
Thank you!
𝑨𝒋𝒊𝒏𝒌𝒚𝒂
Code blocks Compiler is better for C++ or not
Anonymous
Anonymous
And it's very bad
𝑨𝒋𝒊𝒏𝒌𝒚𝒂
Ok
Anonymous
Choose from these
Anonymous
𝑨𝒋𝒊𝒏𝒌𝒚𝒂
Choose from these
Okay but Visual Studio taking up a lot of storage in my device
Anonymous
Clion vs qtcreator who wins?
Anonymous
No ties
Anonymous
It depends
Anonymous
Cn ya elaborate?
klimi
because its IDE and not compiler, and its bad because Danya doesn't like it
Cyber9ja
Cyber9ja
It's a good IDE for beginners
Serenity
int reverse_bits(int num)
{
int reversed = 0;
while (num > 0)
{
reversed <<= 1;
if (num & 1 == 1)
{
reversed ^= 1;
}
num >>= 1;
}
return reversed;
}
Serenity
Is it how I should reverse a binary number ?
Anonymous
hello
Anonymous
can anyone help me?
Lord P∆RTH
Brown
Which assembly language does compiling C files yield ?
Brown
I don't if it is a right way to ask the question.
Anonymous
The question is unclear
артем
Anonymous
Anonymous
Assembly -> assembler -> linker -> executable
Code -> compiler -> linker -> -----------------^
Anonymous
They both eventually reach the same state
Anonymous
But your compiler never converts C to assembly
Anonymous
Pavel
Hello! How would I fix the stack overflow error? I need deep recursion for DFS on large graph.
C, not C++.
Anonymous
Anyone kNow hOw to gEt exAct lOcatiOn oF a fAcebOok uSer?
Anonymous
Anonymous
Offtopic
whAt itS eaSy i Know bUt mY cPu iS bRoken😔
Serenity
What's the difference between Union and structs except for different memory allocation ?
Serenity
And what does it mean that all the union elements share the same memory ?
Anonymous
What's the difference between Union and structs except for different memory allocation ?
A basic definition I believe for unions would be that every element will have (share) same memory. For instance,
a union containing an integer and a double.
In this case the total memory allocated would be the maximum element size, which would be sizeof(double) in bytes thats all.
So in other words, union will take up the space for its larger element because we can use the same memory for other smaller elements too. And note that you can only use it for one element at a time. For example if u initialize an integer, it will hold an integer and you will not be able to use your double, and vice versa.
This is not the case in structure, in structs you will have memory allocated for every element.
Serenity
Well explained, thanks a lot !
Tarak
can any one help to make an android app using c program
Anonymous
Cn anybdy tell me wut this means
Auto add=[&] (auto& w)
Pavel
Is that a joke? Bot bans messages with links to cppreference <dot> com?
Pavel
ok, en<dot>cppreference<dot>com/w/cpp/language/lambda
klimi
Pavel
Oh, I see
MᏫᎻᎯᎷᎷᎬᎠ
Gusy
do you encounter any problems with VSC C++ extension?
Anonymous
What is VSC?
Dima
Dima
didn’t know
Palinuro
MᏫᎻᎯᎷᎷᎬᎠ