C is a double edged sword. On one hand, it's simple and powerful enough that, given enough effort, you can accomplish just about anything you want. However, this power is limited insomuch that you don't have many of the friendly helper-functions that exist in higher level languages, such as string manipulation for example, unless you go ahead and create them yourself.

Case in point - consider the below function used to trim trailing spaces. Submitted by Victor, this code apparently runs in a system that processes financial transactions in real time. For the sake of the system and its users, I hope that there isn't a lot of whitespace.

char *trim_right(char *str)
   int len = strlen(str) - 1;
   if(len == 0 || str[len] != ' ') return str;
   str[strlen(str)-1] = '\0';
   return trim_right(str);
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!