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'm trying to understand why I'm getting a " too few argument to function" message
result = total_area (diameter/3);
and same message come when its volume.
I tried calling both base and perimeter, as height but got a different message, also tried changing the numbers but same.
Look at the definition of the function total_area, and you'll find it is defined to take more parameters.
You only gave it one parameter (diameter/3, aka. one-third of the diameter).This function probably needs a diameter and a height, and perhaps some other parameters(we don't really know because you aren't showing us the definition of the function!)
When you find out what it needs, you'll probably want to call it like:
result = total_area (diameter/3, height, width); // See the other parameters??!
Related
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 9 years ago.
Improve this question
I have two self-made separate gems, but both of them have a same function called foo for example, and foo is implemented in C, and it's under the same namespace, so is there a way to determine if I require both gems, which version of foo I use, or is it a way to make sure I'm actually using one of the gem's foo function, someone recommend to use cerr.
Though I know they're redundant, but so far I don't want to remove on of them due to some reasons.
I searched "ruby programmatically find function definition", and found this answer: How can I get source code of a method dynamically and also which file is this method locate in.
This, plus some brief IRB experimentation leads me to believe that you want to do something like:
filename, lineno = method(:foo).source_location
if filename == "blah"
puts "looks like :foo is defined in 'blah'"
elsif filename == "blargh"
puts "looks like :foo is defined in 'blargh'"
end
Here is some more documentation for source_location: http://ruby-doc.org/core-1.9.3/Method.html#method-i-source_location
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'm new to C and I have an assignment where I have to build a dictionary (Linked List in a way). Basically the user inputs several words,year and their definition this:
Example:
love_#_2004_#_LOVING
trade_#_2001_#_INVEST
etc...
And basically I need a function to scan the definition (Ex: INVEST)
and gives me the word trade.
If the definition is related to more than only one word to give me back all the words it relates to.
What sort of a function do I need to scan these strings?
If the word you search is always the last one and the formatting is always the same, then use strtok with _ and copy the last entry, which holds the string you are looking for.
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...
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);
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.