I have a linked list of around 5000 entries ("NOT" inserted simultaneously), and I am traversing the list, looking for a particular entry on occasions (though this is not very often), should I consider Hash Table as a more optimum choice for this case, replacing the linked list (which is doubly-linked & linear) ?? Using C in Linux.
...
This is NOT a question on plain old boring customization; I actually want to create an program, you know, with source code, etc...
I'm thinking about programming my own media centre interface, and I figured it'd look better if I coded my own splash screen for when the OS is loading.
Note: The media centre interface will be run in X...
I've spent (on and off) the past two and a half years learning C, from books like the k&r. I soon came to the realization that I found the prose difficult to understand, etc. I read the "Teach yourself C in 21 days" book first, but I couldn't even understand it. Now that I have a fair knowledge of how to use the fundamentals of C (this...
I'm preparing some slides for an introductory C class, and I'm trying to present good examples (and motivation) for using pointer arithmetic over array subscripting.
A lot of the examples I see in books are fairly equivalent. For example, many books show how to reverse the case of all values in a string, but with the exception of replac...
DUPE : http://stackoverflow.com/questions/464287/i-want-to-learn-c-closed
(and even that question was closed as duplicate)
Not quite a programming question but important none the less: Which book would everyone recommend for learning C programming language right from the beginning? I have been mostly doing JAVA for the last 2 years b...
I have a program that uses a terminal in raw mode and I want to move the cursor around. Where can I find the escape sequence for this and how can I send it to the terminal from inside my c program?
Here's what I currently have:
char code[4];
code[0] = 27;
code[1] = 91;
code[2] = '*';
code[3] = 'D';
write(1, code, 4);
...
What is better: void foo() or void foo(void)?
With void it looks ugly and inconsistent, but I've been told that it is good. Is this true?
Edit: I know some old compilers do weird things, but if I'm using just GCC, is void foo() Ok? Will foo(bar); then be accepted?
...
Duplicate:
Unique random numbers in O(1)?
I want an pseudo random number generator that can generate numbers with no repeats in a random order.
For example:
random(10)
might return
5, 9, 1, 4, 2, 8, 3, 7, 6, 10
Is there a better way to do it other than making the range of numbers and shuffling them about, or checking the genera...
I'd like to capture the input from a TV remote control and detect which buttons are pressed in my application. The operating system is Linux (Windows answers won't be much use to me, but may be to others). I'm using C++ but C code would work for me also.
I'd like to use the code in a fashion similar to this:
if (remoteControl.buttonPre...
I would like to port my C/C++ apps to OS X.
I don't have a Mac, but I have Linux and Windows. Is there any tool for this?
...
I'm doing some image processing, and I'd like to individually read each pixel value in a JPEG and PNG images.
In my deployment scenario, it would be awkward for me to use a 3rd party library (as I have restricted access on the target computer), but I'm assuming that there's no standard C or C++ library for reading JPEG/PNG...
So, if yo...
On an official sqlite3 web page there is written that I should think about sqlite as a replacement of fopen() function.
What do you think about it? Is it always good solution to replece application internal data storage with sqlite? What are the pluses and the minuses of such solution?
Do you have some experience in it?
EDIT:
How abo...
This question is related to Symbian OS yet I think that C/C++ veteran can help me too.
I'm compiling an open source library to Symbian OS. Using a GCCE compiler it compiles with no errors (after some tinkering :) ).
I changed compiler to ARMV5 and now I have multiple errors with the definitions of static const structs, for example:
I hav...
What Windows API functions are available to execute command prompt's functionality? For example, I like to execute dir command and want to show the output in GUI without using cmd.exe in Windows.
...
Hello,
compiling with gcc C99
I have been using enums for a while now. However, I am using some sample code to develop my application. And I came across some code like this. I have been informed this is the best practice use when using enums. But I don't see how this has any advantages.
typedef enum {
TYPE_DATE,
TYPE_TIME,
...
I have to create a short program in C that manipulates strings, but I always run into some weird pointer errors. While K&R is a great reference on the language, and I often look at it when I am puzzled it already assumes you are an adequate programmer.
The lecturer that teaches us programming said that good programmers make nice diagra...
Hello C people.
I'm looking for a static analysis tool with the maturity of splint that also produces test coverage analysis of the code. For instance, all non-static functions in libfoo.c should be present in libfoo.h, by that token all functions in libfoo.h should have unit tests.
Of course, such behavior would need some kind of gran...
Hello,
What are the most highly regarded books on optimization / performance tuning of C/C++ code?
...
#define IMGX 8192
#define IMGY 8192
int red_freq[256];
char img[IMGY][IMGX][3];
main(){
int i, j;
long long total;
long long redness;
for (i = 0; i < 256; i++)
red_freq[i] = 0;
for (i = 0; i < IMGY; i++)
for (j = 0; j < IMGX; j++)
red_freq[img[i][j][0]] += 1;
total = 0;
for (i = 0; i < 256; i++)
to...
I'm looking for a library for C that gives me at least some of the things I really miss from C++ and the STL/Boost. (I have to use C, so please no "use C++" posts)
I need
dynamic strings (that grow and shrink automatically)
some sort of list (std::vector replacement)
something like stringstream (for type conversations & buffers)
Fur...