c
Pre increment vs Post increment in array
You hit the nail on the head. Your understanding is correct. The difference between pre and post increment expressions is just like it sounds. Pre-incrementation means the variable is incremented before the expression is set or evaluated. Post-incrementation means the expression is set or evaluated, and then the variable is altered. It’s easy to think … Read more
Implicit function declarations in C
It should be considered an error. But C is an ancient language, so it’s only a warning.Compiling with -Werror (gcc) fixes this problem. When C doesn’t find a declaration, it assumes this implicit declaration: int f();, which means the function can receive whatever you give it, and returns an integer. If this happens to be close enough (and … Read more
Cross Platform C library for GUI Apps?
If you are looking for a C++ library, then Qt basically does what you are looking for. If you want to stick to pure C, then Qt is not an option. As a C framework you could use GTK+, it works on Linux, Windows and OS X.
gdb: No symbol “i” in current context
It has probably been optimised out of your compiled code as you only use feature_mask[i] within the loop. Did you specify an optimization level when you called your compiler? If you were using gcc, then just omit any -O options and try again.
C can’t compile – symbol(s) not found for architecture x86_64
You can compile, but you cannot link. part1.o is using the functions you defined in your last .h file and the implementations cannot be found. When you link your program, you need to make sure you’re linking in the object file(s) (or libraries) that contain the implementations of those functions. You’ve likely done something like: gcc part1.c -o myapp and … Read more
Process exited with return value 3221225477
When you scan a number, you need to pass the address of the variable where you want to store the result: where you have Your compiler really ought to have warned you – do you enable warnings when you compile? What is happening here is that the fscanf function writes to the location given (in your case, … Read more
FFT in a single C-file
Your best bet is KissFFT – as its name implies it’s simple, but it’s still quite respectably fast, and a lot more lightweight than FFTW. It’s also free, wheras FFTW requires a hefty licence fee if you want to include it in a commercial product.
Pointer to a string in C?
The same notation is used for pointing at a single character or the first character of a null-terminated string: The values in ptr2 and ptr3 are the same; so are the values in ptr4 and ptr5. If you’re going to treat some data as a string, it is important to make sure it is null terminated, and that you know how much … Read more
GCC: Array type has incomplete element type
It’s the array that’s causing trouble in: The second and subsequent dimensions must be given: Or you can just give a pointer to pointer: However, although they look similar, those are very different internally. If you’re using C99, you can use variably-qualified arrays. Quoting an example from the C99 standard (section §6.7.5.2 Array Declarators): Question … Read more