Various utility functions for C programming