I did read the thread and didn't see anything about non 8 bit bytes.
Type: Posts; User: dnysveen
I did read the thread and didn't see anything about non 8 bit bytes.
sizeof returns the number of bytes and there are always 8bits to a byte.
I should have multiplied by 8 and not 4, my fault.
I came up with another solution to the original question. Does anybody see anything wrong with my solution?
int countBits(int x){
int numBits=0;
int intSize=sizeof(int)*4;
for(int...
I already know all about hex and binary just not what the syntax of the operators are.
THanks for your replies. Can somebody give me a link of an explenation of &0xf and &0x1? Are there other &0x commands? Does &0x1 give you the first bit? I was never taught any bit manipulation in...
I get the shiffting and nibble part now but I don't understand the table. Why does the table have these values.
Edit
Never mind got it. So when the say count the number of bit it means count...
Thanks but nobody really explained to me whats going on. I don't understand the code or what the &0xf and >> are doing. Thanks
I am studying for an interview and I came across an interview that asks to count the number of bits in an int. I have the solution but I do not uderstand either solution. Woul somebody please...
Still did not answer my question on why the devlopers did this. What was there rational? It seems stupid. Its like have multiple ifs and if one if is meet it executes the rest of the if statements...
Why on Earth would the designers of C++ just go on to ignore the rest of the case conditions? That is about the same as ignoring in an if else statement. What was there reasoning behind this? Am I...
I was doing the quiz on this website dealing with Switch Case and I have a question. Question 4 states
4. What is the result of the following code?
x=0;
switch(x)
{
Thanks will read tonight.
BTW how often are VA function used and how useful are they? In all my C++ classes in college this has never been mentioned. I'm trying to learn some things on my own.
That is why I was trying to use. I'm really confused now. Could you please explain this part. Why is fmt a pointer and how does the while loop know when to end? Thanks
while (*fmt)
...
I was just using printf() as an example. This is still a C++ question. Please move back to the C++ forum.
I have a question about Variable size argument functions. When using printf() a variable argument size function you do not need to give the number of arguments in the function call but when creating...
I'm trying to get better at C++ so I have been doing some of the challenges at topcoder.
This was the problem
Given an image as a vector <string>, scale it up by factor. That is, if the...
Good point. I missed that one. Even if he was reading from the file he would not have a linked list.
You also do not have a head pointer for your linked list.
Im not exactly sure what you are trying to do but if you are trying to create a linked list you need to allocated new memory every time you read in a new record and have the previous record link to...
What do you mean it would be surrendering?
Why don't you just make the priority inverse ie 1/priority val.
Don't listen to those guys about the weakness. If you go the site I gave you they actually interview the people who do the Microsoft interview and they won't to know your weakness. The interviews...
If you used a char array you could use the atoi function which converts character numbers to integer values. I think there would be less overhead subtracting 48 or '0' because you are not making a...
I figured he knew how to end his main function. Geeez people
Zuk I understand. I always like to have everything optimized and working the best way. I knew really thought of using -'0' but I do...
Good point. Small oversight when writing the code in under 5 minutes. I wasn't looking to make sure it was "perfect" just that it ran. It was something just to give him and idea.