over the last few days I've been desperately trying to find a working floodfill algorithm. Of the many algorithms i've tried only the 'recursive line fill' one behaves exactly as it should with the major caveat that it occasionally blows the stack. :(
I have tried many non-recursive implementations I've found on various websites and the...
Quick question regarding how memory is allocated.
If someone were to allocate 20 chars like this:
char store[20];
does this mean that it allocated 20 char type blocks of memory, or that it allocated char type blocks of memory starting with 0 and ending with 20. The difference is that the first example's range would be from store[0] t...
I have some basic knowledge of C (and a bit more of C++). I got a copy of K&R, and I want to use it to help me dig deeper into the language. What is a good idea that will involve using most of C's features and standard library? Also, what important differences between C89 and C99 should I be aware of?
EDIT: Forgot to mention, this shoul...
In Bison I have a union
%union
{
std::string* sval;
}
And I want to use it like this
In Lex:
*(yylval->sval) = "ABCD";
Rather than
yylval->sval = new std::string("ABCD");
To prevent memory leaks easily
However I need some way to allocated a std::string to sval to begin with.
How can I do that?
...
Hi,
I want to know, why is it too hard to make a program run in many OSes, like Windows and Linux, without including glue code. They all share the same architecture (x86), so I think it should be simple. Furthermore, C is standardized, so why are implementations diferent in these OSes? Why is it hard to follow the standard and implement...
Hi, I've made a basic interpreter before in C with a preprocessor that took a lot of load off of parsing and such. I would like to port this preprocessor for use in C# now and I'm having trouble, as I am still quite new to C#.
My old preprocessor made it so things like
var $mine= this;
//weird intendtation
var $some...
I'm trying to figure out some things with some firmware that was written for us. I'm not all that familiar with C and I think there's some shorthand going on here that I'm just not getting. I don't understand how the code relates to the comments, particularly how you get 70ms from any of that. Can you help translate into English?
// s...
Edit: I've added the source for the example.
I came across this example:
char source[MAX] = "123456789";
char source1[MAX] = "123456789";
char destination[MAX] = "abcdefg";
char destination1[MAX] = "abcdefg";
char *return_string;
int index = 5;
/* This is how strcpy works */
printf("destination is originally = '%s'\n", destination);
r...
I'm writing a function in C that takes a variable number of arguments.
size_t myprintf(char *fmt, ...);
So far, so good. I've decided it's best to do things the Right Way™ and make a version that takes variable arguments, and another version that takes a va_list.
size_t myprintf(char *fmt, ...);
size_t myvprintf(char *fmt, va_list ar...
Hi Gurus,
I was searching for connecting to database from C program. But I thought the ODBC connections, logon and all need some libraries. Also I am having a minimal compiler like Tiny C Compiler which is very fast. I do not want to use any ODBC logic etc which is needed to connect and query the database.
So I am using a method which is...
i have an array (char data[16]) and i want to get data from user in hex digits so the array looks like :
data[0]=0x887f76b1
data[1]=0x8226baac
...
when the user input was : 887f76b18226baac ...
thank you very very much.
...
Can u Give solution for this code of typecasting, LPCTSTR(here lpsubkey) to Char*
for below code snippet ,
char* s="HKEY_CURRENT_USER\\";
strcat(s,(char*)lpSubKey);
printf("%S",s);
here it makes error of access violation ,so what will be the solution for that?.
...thanks in advance
...
I have a C function named SetParams(...) with a variable number of arguments. This function sets up a static data structure (let us name it Data). SetParams is used with pairs of arguments, e.g. SetParams("paramA", paramA_value, "paramB", paramB_value) etc. It can also be called many times, e.g.
SetParams("paramA", paramA_value);
SetPar...
The following C program doesn't printing anything on the screen.
I compiled the program with gcc:
#include<stdio.h>
main()
{
printf("hai");
for(;;);
}
...
Hi!
I struck a little problem when learning. I know that uninitialized global variables in C are assigned to the .bss section in the executable ELF file. But what happens to them when I start to use them?
I.e. do they get a place on the heap or somewhere else?
I tried to find out by printing the address of the (still uninitialized) glo...
can anybody suggest a good book (or website link)for studying TSR programs in C??
Thanks in advance..
...
As some of you might be aware, there's a bug with either Conky or PCManFM (the desktop manager aspect of it) that makes the Conky window disappear in one of these situations:
Setting "own_window_type override" in .conkyrc (the usual configuration for Nautilus) flat out doesn't show the Conky window at all.
Setting "own_window_type desk...
Hi,
Initially I thought I needed this, but I eventually avoided it. However, my curiosity (and appetite for knowledge, hum) make me ask:
Can a preprocessor macro, for instance in
#include "MyClass.h"
INSTANTIATE_FOO_TEMPLATE_CLASS(MyClass)
expand to another include, like in
#include "MyClass.h"
#include "FooTemplate.h"
template c...
Is there any way to simulate a keypress in Linux using C?
In my specific situation, I'm on Ubuntu 9.04 and need a simple app that invokes a press on the "pause" button when launched. That would get an iframe in Firefox to refresh using Javascript.
...
I come from a java background (from my CS classes) and a semester of C++. I am just finishing up a OpenCV project for my Co-Op that's in pure C, so I'm a bit late in asking this question.
What are the design processes and coding standards for pure C?
I'm familiar with object oriented programming, design and best practices. I'm jus...