C Programming

A series of little how-to guides and tutorials for the C programming language.

A Programming Challenge Discussion – Returning Pointers To Local Variables

Last week’s challenge was a tough one, so don’t be alarmed if you had no idea what the issue might have been. Also, it can be hard to spot problems in a functional program because you tend to concentrate on what the code is actually doing, rather than the validity of the code itself. To give…

A Programming Challenge

I have a challenge for you. Is there a problem with this code? It compiles without warnings, and runs as expected. I’ll reveal all next week. Have fun! g++ -g -Wall palindrome_problem.cpp #include <iostream> #include <string.h> using namespace std; char* isPalindrome(char* word) { char* ret = 0; ret = (char*)”Yes! This is a palindrome.”; char…

atoi and itoa

atoi and iota seem like perfect partners. atoi is the ‘ascii to integer’ function and itoa is the reverse, the ‘integer to ascii’ function. You would use atoi to convert a string, say, “23557” to the actual integer 23557. Similarly, you would use itoa to convert an integer, say 44711, to the equivalent string “44711”….

| | |

make: Nothing to be done for ‘all’ – Eclipse Error Solved

I’ve seen this odd error several times over the years, almost always after first importing a new project into Eclipse-CDT. After import, when you try to build your project, it just returns the message make: Nothing to be done for all in the console. And then, once you’ve got the error, nothing you do will kick your…