Calculation of Poisson distribution in C
I need a C function to calculate Poisson distribution for values of k upto 720. I need a highly efficient solution. I urgently need this solution. Thanks in advance ...
I need a C function to calculate Poisson distribution for values of k upto 720. I need a highly efficient solution. I urgently need this solution. Thanks in advance ...
If I declare a constant say "#define MONTHS =12" in C I am aware that pre-processor directive will replace whereever MONTHS is used, but want to know if a memory is allocated to store 12??, if yes, what would be the label and what would be the datatype. ...
Hi, i encrypt a file using ideas from tldp.org/LDP/LG/issue87/vinayak.html. I downloaded and compiled this source code for encrypting/decrypting a simple text file. Once compiled I do: ./blowfish input_file.txt output_enc.txt output_dec.txt I use the options: G for generating a key E for encrypting the file, so output_enc.txt is ...
Is there a simple way to work with C++ objects directly from C? I want to expose some classes from C++ to C or to FFI(foreign function interface). Sure, I can write a stuff like that: class Foo{ .... }; void *make_foo(...){ Foo *ptr = new Foo(..) return static_cast<void *>(ptr); } .. int *foo_method1(void *fooptr, ...){ Foo *ptr = s...
I currently have the dynamic array: char *myData[500][10]; //myData is the name of an array of[500][10] pointers to type char. I would like to create a static 2d array, 500 rows X 10 columns, each element storing memory for 40 characters. Would below be the correct way of declaring that? char myData[500][10][40]; ...
Can someone explain why this doesn't work? int main() { float* x; float a, b; int num_vals = 10; fill_in_x(&x, num_vals); // malloc is called and x is populated with values a = x[0]; b = x[1] - x[0]; printf("%f\n", a); printf("%f\n", b); function_using_a_and_b(a, b); // The values of a and b used ...
char myData[505][3][50]; //2D array, each 50 chars long char **tableData[505] = {NULL}; const char* text; text = sqlite3_column_text(stmt, col_index); strcpy(myData[row_index][c_index],text); tableData[row_index] = myData[row_index][c_index]; <--? I would like to assign the pointer to pointer array tableData to the content o...
We are looking to migrate a performance critical application to .Net and find that the c# version is 30% to 100% slower than the Win32/C depending on the processor (difference more marked on mobile T7200 processor). I have a very simple sample of code that demonstrates this. For brevity I shall just show the C version - the c# is a direc...
Here's the problem. I'm getting the following string as parameter to my function: HKEY_CURRENT_USER\Software\MyProgram\SomeKey where SomeKey is a REG_DWORD and has a value. I need to read and write to that key (SomeKey) but all the registry functions that I know take HKEY_CURRENT_USER separately from the rest of the key (\Soft...
I have been reading over some code lately and came across some lines such as: somevar &= 0xFFFFFFFF; What is the point of anding something that has all bits turned on; doesn't it just equal somevar in the end? ...
I'd like to change the way some types are displayed using either 'dt' or '??' in a manner similar to how you can do that with autoexp.dat. Is there a way to do this? For example, I have a structure something like this: struct Foo { union Bar { int a; void *p; } b; }; And I've got an array of a few hundred o...
This might be a little QT specific, but here we go... I've got a QT app that I need to interface with a couple of external libraries written in C. Everything seems to be working, as I can link correctly, but when I try and call any function in one of the libraries I always get an access violation error. For the other library, I call l...
I'm writing a C program for OS X and Linux, and I want to tweak the output based on whether or not it's going to a terminal. I know we've covered how to do this in a shell script, e.g. here: http://stackoverflow.com/questions/911816/detecting-the-output-stream-type-of-a-shell-script But how do I do it in a C program? ...
I've been trying to gain a deeper understanding of how compilers generate machine code, and more specifically how GCC deals with the stack. In doing so I've been writing simple C programs, compiling them into assembly and trying my best to understand the outcome. Here's a simple program and the output it generates: asmtest.c: void main...
Hi, Can you help me with this? I want to accept a sentence from the user and print each word in the sentence to the user.... I need a C program to do this! ...
Hii I wanna copy an NTFs partition to another partition of same type and same size.And I tried with windows function Copyfile() and it worked but slow speed is a problem.Then I did with readfile() and WriteFile() instead of Copyfile() again speed is a problem. How can I get a better speed...?? I did the same operation in kernel mode a...
Please explain the syntax of: system(const char *command); I want to use this function for running the command on unix sytem. I need to execute(automate) several test cases with the same command but,they also have other input values which are different.how do I reuse this code for all the test-cases. ...
I'm using srandom() and random() to generate random numbers in c on a Unix system. I would like to have multiple RNGs. Each one, given the same seed, should output the same sequence. I would also like to save and restore the state of each one. Here's a pseudocode example: R1 = new_rng(5); //5 is the seed R2 = new rng(5); //5 is the ...
I would like to use complex numbers as defined in C99, but I need to support compilers which do not support it (MS compilers come to mind). I don't need many functions, and implementing the needed functions on compilers without support is not too difficult. But I have a hard time implementing the 'type' itself. Ideally, I would like to ...
hello, how should one ensure correctness when multiple processes accesses one single SQLite database file? Show me the code please :-) /tom ...