It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a 4 digit decimal number say 1234. I want to split this number into 4 separate ASCII values like '1','2','3','4'.
The process should not include division operation or integer to string conversion etc.
You want to extract each digit of the number and add '0'. If this is against your requirements, feel free to ignore.
you can anytime change division operator subtraction anytime.
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
If I have to store and do an operation on integers in the wide range of [1, 10^50000]. How can I do them? How can I store such large integers values first of all? And, how can I perform basic operations on them subsequently?
There are specialized libraries for arbitrary precision that will help you with this. One I had success with is GMP.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I need some help answering the above question Any twiddling idea?
You'll get a lot more here: Bit Twiddling Hacks
Treat one of the inputs as a bitmask. For each bit in it that is set, you want to add the other input, shifted that many spaces left, to your result. This assumes unsigned inputs: non-2's-complement signed inputs require special treatment of the sign bit.
I think I can safely predict that this will be less efficient than the CPU's built-in multiply operation.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
map[0][4]='\0';
city1[0][4]='\0';
strcpy(map[0],city1[0]);
map[0][0]='z';
printf("%s",map[0]);
printf("%s",city1[0]);
printf("%d \n",strcmp(map[0],city1[0]));
The output of this function is zail
nail
12
Why it is so? What I did not understand about strcmp? Why 12 and not any other number?
To answer your question,
strcmp("zail", "nail")
is evaluating to 12 because it's subtracting the 'n' in "nail" from the 'z' in "zail", and 'z' - 'n' = 12.
You're getting random junk because you're not initializing your arrays properly.
Instead of
map[0][4]='\0';
city1[0][4]='\0';
Try
memset(map[0], '\0', sizeof(map[0]));
memset(city1[0], '\0', sizeof(city1[0]));
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am learning C language and got the following range of primitive data types:
I dont know where the values in the Range column come from.
If int is 16-bit, it means there are 2^16 different values. Of these, 2^15 (= 32,768) (half) are negative, 2^15 - 1 (= 32,767) are positive and the last one is 0.
The same reasoning can be used for 8-bit, 32-bit or any other size of integer.
For floating point numbers (float and double), the how the range is explained on Wikipedia or on Steve Hollasch's page on IEEE Standard 754 Floating Point Numbers.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Hello I do not what type of this program called, but I will do my best to describe it.
I want to write a program preferably in C that prints using ASCII characters to print large characters similar to diodes signs
Eg.
Output:
#
#
#
#
#
#
for characters L
On linux, the programs banner and figlet can do what you want. Look them up on google.