Two to the power of some large number [closed] - c

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Can anyone tell me how to find (2^101100111000)%1000000007 in C?
There is a problem in which we have to convert a number into binary(1<=N<=600000) and find
2^(binary representation of N)modulo1000000007.

The values you are talking about will not fit into a standard long on any architecture, so you will have to use an arbitrary precision maths library such as GMP.
Hmm, just read Zong's answer... he's pointing to a more efficient method... haven't finished reading through the article but it looks like the better way to go...

Related

Comparison of two dna sequences in C [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I would like to compare two dna sequences in C. How can i compare two strings and gets the difference?
Let's say:
seq_a:
GATCAACGCAAAGGACTAAGCACTGCTGCCAAA
and
seq_b:
GATCAACGCAAAGGACTAAGCACTGCTGCCTGC
result: TGC or GATCAACGCAAAGGACTAAGCACTGCTGCC***
Hard-code the traversal of two strings in a while loop. If they're the same, output either string1[i] or string2[i]. If they're different, write a star.

Scan numbers as string [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
my input is of form of: number:number for example 16:13
my goal is to take this input and break it to the two numbers.
for example first number is 16, second number is 13.
is there a way to use SCANF to read the numbers directly? or the only was is to use a function to convert the string to numbers after i lose the separator?
i can not change the format of the input.
This should do the trick.
scanf_s("%d:%d", &num1, &num2);

C programming structure access [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I found this line in Linux Audio drivers soc-core.c inside sound folder:
int regsize = codec->driver->reg_word_size * 2;
Can anybody please explain the meaning of * 2?
Multiply the contents of codec->driver->reg_word_size by 2. I guess this is a translation between size in words to size in bytes.
Multiplies that value by 2. That's all it does
Well, I can just guess, but it looks like this:
codec is a pointer to a structure, which has a pointer to another structure in driver, which has a member variable reg_word_size (which it seems is, like the name says, the size of a register word). This value gets doubled (*2).
This could be, like the other answer says, a conversion between bytes and words. However, it could probably also just mean that this regsize should be twice as big as the reg_word_size.

How to store an array in heap? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I'm a C beginner and I'm learning "heap" currently. One thing confuse me is can we store an array in heap? If we can, how?
Say for example:
int main(void) {
char sentence[] = "Please move me to heap.";// I want to store this sentence in heap
printf("%s\n", sentence);
}
Can somebody clarify this point to me? Thanks in advance.
Please have a look at this C tutorial and then have a look at malloc.
There is an example use of malloc here. If you are learning, it is better to read a slightly longer tutorial than for us to give you the answer in code as the former will better your understanding.

Where can I get a CRC (Cyclic Redundancy Check ) code? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am looking for a package, or easy implementation of CRC 16-bit code by MATLAB
How about file exchange?
http://www.mathworks.com/matlabcentral/fileexchange/20350-16-bit-itu-t-crc

Resources