Hi, I'd like to know if someone can explain me the solution to this problem:
the code is:
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int c[20];
int n;
} t_coda;
t_coda coda;
void init(t_coda *coda) {
coda->n = 0;
}
void add(t_coda *coda, int x) {
if (coda->n < 20)
coda->c[(coda->n)++] = ...
i have an assignment,and i need help!!
in a given 2D ARRAY of integers and a given MAXIMUM number of steps the program supposed to
find a path, from one corner to the one in front of it, which sums the biggest numbers in limited number of steps.
this supposed to be done with BACKTRACKING RECURTION...
...
I have a system that needs at least 10 mseconds of accuracy for timers.
I went for timerfd as it suits me perfectly, but found that even for times up to 15 milliseconds it is not accurate at all, either that or I don't understand how it works.
The times I have measured were up to 21 mseconds on a 10 mseconds timer.
I have put together...
I'm investigating using nvidia GPUs for Monte-Carlo simulations. However, I would like to use the gsl random number generators and also a parallel random number generator such as SPRNG. Does anyone know if this is possible?
Update
I've played about with RNG using GPUs. At present there isn't a nice solution. The Mersenne Twister that c...
Which option should be enabled in gcc to generate 16-bit or 32-bit or 64-bit object code ? Are there separate options for generating each of the above object code type ?
...
I'm looking to add basic licensing to my application. I want to take in the user's name as a parameter and return a unique, fixed length code (sort of like MD5)
What are some algorithms that can do this?
Thanks
...
I'm working through a chapter about iPhone audio and have come across a section of code that I can't make sense of:
while (aqc.playPtr < aqc.sampleLen)
{
select(NULL, NULL, NULL, NULL, 1.0);
}
(Full code sample is on pages 163-166). From what I understand of the code the audio is being processed on another thread and the while lo...
I want to make a simple just-in-time compiler with c on Linux.
How can I allocate memory such that I can write out raw x86 code to it and execute it as any other function?
...
I'm stuck on this. Currently I'm using:
FILE *a = fopen("sample.txt", "r");
int n;
while ((n = fgetc(a)) != EOF) {
putchar(n);
}
However this method seems to be a bit inefficient. Is there any better way? I tried using fgets:
char *s;
fgets(s, 600, a);
puts(s);
There's one thing I find wrong about this second method, which is tha...
I'm doing a school project about maintaining a personal Database. but my tutors didn't explained the practice, they explained the theory(Data structures and such) not how to code in c.
We where given a certain amount of tables, indexes and consults they wanted to solved and we are to program the data structures that run behind.
I ch...
I was reading this article on MSDN
"Managing Heap Memory in Win32"
And in it they are explaining about a tool called ProcessWalker.exe
In the article they explained that they can use this tool to explore the contents of virtual memory of any process.
Does anyone know where I can download this tool from. Or maybe ProcessWalker might b...
Possible Duplicate:
When you exit a C application, is the malloc-ed memory automatically freed?
In C, is it necessary to free a pointer at exit?
When the program exists, does it free memory from pointers still pointing to an allocated block?
Is it dependent on the OS?
...
I'm trying to get the text from a tab control like this:
TCITEM itm;
itm.mask = TCIF_TEXT;
TabCtrl_GetItem(engineGL.controls.MainGlTab.MainTabHwnd,i,&itm);
but the psztext part of the structure is returning a bad pointer (0xcccccccccc).
I create the tabs like this:
void OGLMAINTAB::AddTab( char *name )
{
TCITEM ...
Having issues trying to retrieve a effect file for directX. If I do not include the D3DX10CreateEffectFromFile() method, the application compiles correctly. If I do include it. I get the following error
1>GXDX.obj : error LNK2019: unresolved external symbol _D3DX10CreateEffectFromFileW@48 referenced in function "public: virtual void __...
I have a thread datatype in the interpreter implementation for a programming language I am working on. For various reasons, it’s a fairly common operation, to need to get the current thread (which is, itself, a pointer: a struct thread*).
However, pthread_self(3) hands me a pthread_t, which is an opaque type; on some systems, it seems t...
Hello,
I have foowing code fo runing function in another thread:
void load (....)
{
GIOSchedulerJob *job;
g_io_scheduler_job_send_to_mainloop(job,(GSourceFunc)job_func,¶m, g_free);
}
gboolean job_func(GIOSchedulerJob *job, GSourceFunc func, gpointer user_data, GDestroyNotify notify)
{
JobParam* job_p...
Hi all,
I just write a procedure to decompose an unsigned integer to prime numbers. it will work normally if I define the data type as "int", if I change it to "long", result will be wrong. I don't know why.
BTW, I used Win-TC as my compiler.
Code as below:
#include "stdio.h"
#define True 0xff
#define False 0x00
char DividerIsPr...
Hello
Suppose I do a system("ps-C nautilus"); how do I return the result of this function in char* ?
Thank you.
...
I need a user-mode filesystem filter (not virtual filesystem). One of such frameworks is http://eldos.com/cbflt/, but it has some bugs and I need an alternative.
Suggest similar frameworks.
...
I need to break down the amounts on their respective bill/coin.
The output is somewhat like this:
So far, here is my code: (I made the last few codes a comment one 'cos the
errors come from there)
{
int x,y;
printf("Enter input: ");
scanf("%d",&x);
y=x/1000;
printf("\n# of $1000 bill: %d",y);
x = x%1000;
y=x/500; ...