Actually, your code is "almost C++". I see you store function pointers in C structs. You are already coding in an object-oriented fashion, even if you don't realize it yet.
I think you have...
Type: Posts; User: Sander
Actually, your code is "almost C++". I see you store function pointers in C structs. You are already coding in an object-oriented fashion, even if you don't realize it yet.
I think you have...
examp is a pointer, which (on a 32-bit system) is 4 bytes in size. *examp is what its points to, which in this case is the size of your structure.
You can. The drawback to this technique is...
Because C has made the "choice" of mapping closely to the computer hardware. In the lowest level of your computer, the CPU performs "wraparound" (as mentioned above) when values don't fit in its...
The *scanf() functions return the number of items read. You shouldn't compare the return value with EOF.
--
Computer Programming: An Introduction for the Scientifically Inclined
I find this hard to believe. Either you were comparing different compilers, or something was botched with the comparison.
--
Computer Programming: An Introduction for the Scientifically Inclined
That depends on what your definition of "bitmap" is. If you mean "the contents of a BMP file" then you are right. But you could also mean "a rectangular array of pixel values" (as opposed to a...
Yes, like Daved said. I would assume that your image class also has some method to get at the pixel data (which you had elided for briefness). A reasonable rule of thumb is that if a function can...
That's what all but the most trivial bitmap file formats have. It depends on the exact file format (i.e., is it a BMP file? GIF, JPEG, TIFF, PNG?) what the precise layout of this file header is. ...
You can indeed. See Syntactic Aspartame: Recreational Operator Overloading which was published in the Feb 2006 issue of C/C++ User's Journal (the last issue before it's demise).
--
Computer...
Why are you making DownsampleNTimes a member function?
--
Computer Programming: An Introduction for the Scientifically Inclined
It depends in what format the bitmap file is. Many image formats can be read/written with freely available libraries (libjpeg, libpng, libtiff); other formats are relatively simple and can be...
Maybe this would be of interest to you, too. Otherwise, you could indeed just use the installed compiler, perhaps using some self-written glue so it produces a linkable binary, which you can load...
Actually MS did a pretty good job with C++/CLR. Much better than "Managed C++" where I was constantly having to be paranoid about which pointer was a "real" one and which one was "managed".
Also:...
Not really. In fact, your compiler may already be warning you about using an un-initialized variable.
What you do is define a pointer-to-C-string, then dereference it before giving it a value.
...
That's actually not so unbelievable. Since the fprintf(...) family of functions is not type safe, it has to rely on your format specifiers to know how to interpret what's on the stack. If you...
It should be apparent from the name of the function, too. If a function is called "thatWorked()" then I would expect it to return non-zero on success, because that would be easier to read. If you...
Exactly. You define your structs as holding a pointer, but that pointer doesn't point to any allocated memory. Yet you poke data into it in your program. The fact that it doesn't crash when...
Look up "homogeneous coordinates" for an elegant way to include translation in your matrix multiplications.
--
Computer Programming: An Introduction for the Scientifically Inclined
That is interesting. I would expect that the compiler can see that m is being used while not initialized.
I just verified: gcc 3.4.3 indeed doesn't complain, Visual Studio 2005 gives a warning:...
In the thread title, he says he can't use pow() and can't link to the math library. Probably because it's a homework assignment and he is supposed to implement pow() himself.
Note, BSmith4740,...
Yes, that's fine. Elysia is right; what's probably goinig on is that your header contains
extern "C"
yet the function is returning a C++ type.
--
Computer Programming: An Introduction...
I don't think it will be easy to work out the specifications for your new type. I assume you're trying to make some kind of "wrapper" allowing you to do ordinary math operations, but keep the result...
That isn't worth much: adding zeros at the end of floating point constants doesn't make them more precise.
To someone new to computer programming coming from a science or engineering background,...
- Will your "custom ranges" always be within the range of an available integer type?
- Do you want to stick to integers?
--
Computer Programming: An Introduction for the Scientifically Inclined
Yeah. It was more of a theoretical possibility...
--
Computer Programming: An Introduction for the Scientifically Inclined