I want to program an emulator ( may be NES or C64, I haven't decided yet ), I know there are lots of them so many may ask why would someone want to make one from scratch, but I want to include some specific characteristics in it, and also for the sake of building it myself.
I'd like to read a guide from someone who has built one and can ...
I'm just beginning to wrap my head around function pointers in C. To understand how casting of function pointers works, I wrote the following program. It basically creates a function pointer to a function that takes one parameter, casts it to a function pointer with three parameters, and calls the function, supplying three parameters. I ...
Hi Guys,
need some advice on this one as im struggling abit and cannot figure it out.
i have a file that gets updated on a PC to indicate a system ran and what time it ran. i am writing a very simple linux console app (will eventually be a nagios plugin). that reads this file and responds depending on what it found within the file.
i a...
hi i am interested in those chars which are representable by ascii table. for that reason i am doing the following:
int t(char c) { return (int) c; }
...
if(!(t(d)>255)) { dostuff(); }
so i am interested in only ascii table representable chars, which i assume after conversion to int should be less than 256, am i r...
I have heard of a limitation in VC++ (not sure which version) on the number of nested if statements (somewhere in the ballpark of 300). The code was of the form:
if (a) ...
else if (b) ...
else if (c) ...
...
I was surprised to find out there is a limit to this sort of thing, and that the limit is so small. I'm not looking for comme...
I get this:
LLIST *mylist[N];
Where N is the number of rows of the input file. Then mylist[i] is a pointer to the ith linked list.
I call a function
LLIST *list_add(LLIST **p, int i){
LLIST *n;
n = (LLIST *) malloc(sizeof(LLIST));
if (n == NULL)
return NULL;
n->next = *p; /* the previous element (*p) now ...
Hi,
I found that handy opencv library and tried to program a simple imagemodifier with it using C. When I started to compile my code I got some errors, that are a bit confusing as they doesn't seem to make sense. This is my first time when programming with netbeans and first time I'm trying to make something else than those basic calcul...
Hello I recently asked some questions on linked lists in C.
The link was found here
First I want to thank everyone for helping me with this. But I have one issue I cannot understand. I even asked the professor but he emailed me back with little information. Basically I am writing a linked list in C (see above link). One of the thing...
I have some really weird crash here, ive got it before, but i thought i fixed it by adding = NULL to the variable declarations:
#include <stdlib.h>
...
GLuint *TEX = NULL;
int TEX_MEMSIZE = sizeof(GLuint)*1024*1024;
...
void something1(){
...
TEX = (GLuint *)malloc(TEX_MEMSIZE);
...
}
void something2(){
...
// t...
I'm new to using C programming I was wondering if there is a function call that can be used to quickly determine the amount of rows in a text file.
...
Can I somehow tell GStreamer to look for plugins in a specified directory?
...
Can I do something like this? Will this work?
double *vec_subtraction (char *a, char *b, int n)
{
double *result;
int i;
for(i=0; i<n; i++)
result[i] = a[i]-b[i];
return result;
}
and then in main:
double *vec=vec_substraction(a, b, n);
for(i=1; i<n; i++)
printf("%d", vec[i]);
a and b are v...
This does work
LLIST *mylist[10] = {NULL};
But would if I wanted to do this I get errors:
int x=10;
LLIST *mylist[x] = {NULL};
x can be any value I'm setting it to 10 for the time being. x is going to be used as a counter.
...
I am trying to solve a simple linear equations system using LAPACK. I use dbsvg method which is optimised for banded matrices. I've obsereved a realy strange behaviour. When I fill the AT matrix this way:
for(i=0; i<DIM;i++) AB[0][i] = -1;
for(i=0; i<DIM;i++) AB[1][i] = 2;
for(i=0; i<DIM;i++) AB[2][i] = -1;
for(i=0; i<3; i++)
for(j=...
Is len correctly initialized and safe in set_array call?
void object_copy (Object* self, Object* obj) {
int len;
object_set_array (self, object_get_array (obj, &len), len);
}
If not, what would you recommend?
...
So I have...
int x; LLIST *mylist[x]; x =10;
bzero(mylist, sizeof(LLIST *)*x);
this does not seem to be a valid solution..
I did add the -std=c99 to my make file, just this alone did not work which is why emil suggested the above approach, because I had originally:
int x=10;
LLIST *mylist[x] = {NULL};
My make file lo...
Hi, I'm learning C with The C Programming Language (K&R).
Since I don't particularly want to bob back and forth between a text editor and running gcc, I've decided to use xcode as an IDE. So far, I've been able to follow the book's examples without a problem up until section 1.5.2.
When given the valid (?) program...
#include <stdio.h...
Is the following code valid
int main(){
int * a = 0;
if ( !a ) {
int b[500];
a = b;
}
//do something with a,
//has the array a is
//pointing too gone out
//of scope and garbage
//or is it still fine?
}
...
Is it possible to do something along these lines:
#define import_and_other(s)\
something\
#include s
Such that:
import_and_other("file.h")
becomes:
something
#include "file.h"
Basically, there are certain files that always need the same action taken before they are included, so I want to wrap up #include to perform these actions...
The following shows ♠♣♥♦ on windows xp, will it for all systems??
#include <stdio.h>
int main(int argc, char *argv[])
{
for (int i = 3; i <= 6; ++i)
printf("%c", (char)i);
getchar();
return 0;
}
...