≡ Menu

C Programming

GPROF Tutorial – How to use Linux GNU GCC Profiling Tool

Profiling is an important aspect of software programming. Through profiling one can determine the parts in program code that are time consuming and need to be re-written. This helps make your program execution faster which is always desired. In very large projects, profiling can save your day by not only determining the parts in your [...]

{ 25 comments }

In C language, the life time and scope of a variable is defined by its storage class. The following are four types of storage class available in C language. auto register extern static In this article, we will discuss the ‘static’ storage class and explain how to use static variables and static functions in C [...]

{ 47 comments }

C Thread Safe and Reentrant Function Examples

Re-entrance and thread-safety are two different concepts that can be associated with good programming practices. In this article we will try and understand both the concepts and their differences with the help of some code snippets. 1. Thread Safe Code As the name suggests, a piece of code is thread safe when more than one [...]

{ 14 comments }

As with any OS, file handling is a core concept in Linux. Any system programmer would learn it as one of his/her initial programming assignments. This aspect of programming involves system files. Through file handling, one can perform operations like create, modify, delete etc on system files. Here in this article I try to bring [...]

{ 47 comments }

Howto: C Programming with Temporary Files in Linux

Sometimes while designing a software, you might have a requirement to hold some data (for reprocessing at later stage) for some duration. Some software do it within the memory in which they are running while others may create a temporary file for this purpose. Creating temporary files to hold data is a popular practice among [...]

{ 7 comments }

Howto: C Programming with Directories on Linux

When it is said that in Linux everything is file then it really stands true. Most of the operations that we can do on files can be done on other entities like socket, pipe, directories etc. There are certain situations where a software utility might have to travel across directories in the Linux system to find [...]

{ 8 comments }

A library is a file containing compiled code from various object files stuffed into a single file. It may contain a group of functions that are used in a particular context. For example, the ‘pthread’ library is used when thread related functions are to be used in the program. Broadly, a library (or Program Library) [...]

{ 25 comments }

C Constant Pointers and Pointer to Constants Examples

Pointers in C has always been a complex concept to understand for newbies. In this article, we will explain the difference between constant pointer, pointer to constant and constant pointer to constant. This article is part of the ongoing series on C pointers: part 1, part 2, part 3 (this article) Constant Pointers Lets first [...]

{ 38 comments }