I was asked a question recently that went something like this: “If a for loop is faster when it’s unrolled, why does my boss always want me to make my code shorter by using for loops, when my way (loop …
Read moreIs C a high-level language or a low-level language?
All programming languages are effectively on a spectrum of abstraction. Some are more abstract than others. So, with this in mind, within the set of high-level languages, you’re going to see some that abstract the inner workings of the machine …
Read moreWhy do some experienced C developers avoid certain features of C99 and later standards?
Professional software developers who use C to develop source code that is portable across compilers will often find themselves avoiding certain newer features of the language, not from lack of knowledge or understanding, but because not all compilers implement all …
Read moreIn C++, when should I use a class vs a struct?
In C++, the only technical difference between a struct and a class is that, by default (i.e., if you don’t specify anything), members of struct are public while members of a class are private. You can achieve encapsulation in a …
Read moreCan data structures and algorithms be implemented in assembly language?
Yes, absolutely. Any general-purpose programming language, including all assembly languages, can be used to implement data structures and algorithms. Data structures and algorithms are independent of the implementation language. In fact, some instructors and authors present them using pseudocode or …
Read moreDoes the free function make a pointer NULL in C?
No, it doesn’t. The free library function places the specified block of memory back onto the heap’s free list (at least conceptually…actual implementation details can vary). But the free function doesn’t have access to the memory containing the pointer, because …
Read moreWhy do some developers advise new developers to ignore using Microsoft Windows?
I’ll go out on a limb and say, “Real developers don’t give advice like this. And if they do, they should examine their own motives and biases before giving that advice again.” It turns out that, although I might have …
Read moreGetting the Windows screen resolution in C
How you go about getting the screen resolution is dependent on the operating system and/or hardware you’re using. There is no concept of screen resolution in the C standard library. If you’re running an operating system, you could use the …
Read moreWhat’s the point of callback functions?
A callback is a function that you supply, which will be called sometime later on. Different programming languages provide different ways of specifying callback functions. Callbacks are useful in many scenarios, but they generally fall into one of two categories: synchronous …
Read moreDoes developing maintainable code really matter?
Yes, it does matter. I read a question recently about the importance of software maintainability: “Does writing maintainable code really matter, when the company rarely adds new features, and they tend to scrap each version for an entirely new one …
Read more