i was hopefully after some tips opposed to solutions as this is homework and i want to solve it myself
I am firstly very new to C. In fact i have never ... |
For example, 6 => [1,1,0]
|
I am doing some microcontroller programming in C. I am reading from various sensors 4 bytes that represent either float, int or unsigned int. Currently, I am storing them in unsigned ... |
I am writing a c program. I have an unsigned integer (16bit) whose value could be anything at any time and I have a signed char (8bit) whose value could be ... |
I'm trying to convert an integer such as 10 into the integer 1010 which would be it's binary equivalent, I would think my solution should work but I'm getting a segfault ... |
Possible Duplicate:
Can I use a binary literal in C or C++?
I am learning C and i recently found out that we can represent integers ... |
Here's a macro that Mathew Hendry posted back in the year 2000 for achieving binary integer literals that evaluate to compile-time constants: #define BIN8(n)\ (((0x##n##ul&1<< 0)>0)|((0x##n##ul&1<< 4)>3)\ |((0x##n##ul&1<< 8)>6)|((0x##n##ul&1<<12)>9)\ |((0x##n##ul&1<<16)>>12)|((0x##n##ul&1<<20)>>15)\ |((0x##n##ul&1<<24)>>18)|((0x##n##ul&1<<28)>>21)) Now admittedly I don't know how it works mathematically, but still I want to perfect it. The first thing I did was made it more readable (in my own opinion ... |
|
|
I have a problem in this C++ program That i have written. help me with the problem that i have mentioned below I have written this program to convert a integer to binary digit problem one is that the binary conversion that i get is inverse i.e if the conversion for 16 is 10000 but this program will output it as ... |
gsl wrote: Can anyone tell me how to reverse an integer number represented in binary form(or we can say binary reversal of int)? for ex: given 101100 .... the answer should be 001101 Why? What are you actually trying to achieve? (homework?) What have you already tried? If you want help, fine, but show us that you're prepared to do some ... |
You are missing the headers stdio.h and tchar.h You are missing a " in the second printf statement You have a ; following the for statement mask>>1 does nothing you mean mask>>=1 As written this only outputs a single digit because there is no code block following the if statement. Because mask=8 this only works for values in the range 0<=inumber<=15 ... |
P: n/a rayw I've been trying to write a program that converts an entered number into its binary representation using three different techniques - bit shifting, mod 2, and itoa.. However, I'm getting 'snow blind', and can't get the non-ISO itoa to work as I'd like. The snow blindness makes me think it's me, and not the function! The idea of ... |
"Hello I have a long binary string in a char array like this char abc [] = "100000001010000000110010"; I need to convert this string to a long long. I can't use atoi to convert it to long long using atoll because this string is more than 10 (11 including null termination) characters long. And starts giving me junk values. Once I ... |
well the full question is: define an unsigned long integer and initialise it to the binary pattern 0101 111 0001 1000 1001 0010 1101 0011: Using hexadecimal notation print the hex value on the console. Write a function to print a long integer on the console in the hex and binary form. Now perform the following operations on the pattern and ... |
What Salem is referring to is that some processors (in fact most that are not x86) do not accept memory reads from unaligned addresses, e.g. a 4-byte word must be aligned to a 4-byte block in memory. Bus error is the common message from the processor for "unaligned access", but it is sometimes called other things. |
|
i wrote a program that was supposed to run a function that makes a conversion of inter digits to binary when i try to compile the program, the following errors come up: int_to_bin.c:33: error: conflicting types for 'counv' int_to_bin.c:28: error: previous implicit declaration of 'counv' was here int_to_bin.c: In function 'counv': int_to_bin.c:87: warning: return makes integer from pointer without a cast ... |
|
My assignment was to have the user input an integer and have the program output the binary notation of that integer. I have to write a function to perform the binary calculation. I think I have it mostly completed but I have to reverse the string when the values are stored in the array to print out the correct notation. Should ... |
Code: void bin(int num,char * string) { int i = 0; while(num != 0) { if( (num % 2) != 0) string[i++] = '1' else { string[i++] = '0' } num = num >> 1; } } the "num" parameter is the number u want to convert to binary, and the parameter "string" is a string to put the binary digits ... |
What would be the best c++ data type to store a binary number? Should i store it in a long,float,double,etc.. I would like to output user inputted data on the parallel port letter by letter. How would i go about processing the char array? When i do get the value that it should be in binary how do i convert it ... |
|
Hi, Could anyone please help me with this problem I have? Basically I have a char* called request. Now I can output the integer form of this variable by simply doing: printf("%d\n", request); Say, for example, I get the number 1244714. In binary this is: 10010111111101010 Okay so my problem. I need to know how I can get the length of ... |
#include void dec_bin(long long int number); int main(void) { long long int input = 0; printf("Enter a number (0-8589934591): "); scanf("%lld", &input); (input >= 0) && (input < 8589934592) ? dec_bin(input) : exit(1); return 0; } void dec_bin(long long int number) { long long int x, y; x = y = 0; for(y = 32; y >= 0; y--) { ... |
|
|