C Programming Tutorials

C Programming Tutorials And Articles
  Title / Author Replies
Views Reverse Sort Order
After writing Why main() should not have void as return type? article the other day, suddenly one more question came up into my mind about the signature of main() function. In the earlier article I discussed about why 'void main()' should not be used when ANSI C expects the function main() to...
1
2,602
Code for Integer Into Words #include<stdio.h> void main() { long int n,t; char a={" ","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten"}; char b={" "," ","Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety"}; char c={"...
1
2,490
malloc allocates certain amount of memory during program execution and free de-allocates memory previously allocated using a call to functions like malloc, calloc or realloc. Memory leak can occurs when a program allocates memory but does not release it. Understanding malloc() & free() ...
0
2,378
In this article we will extend our code to print more comprehensive information about a file/directory in a directory. Please Refer Developing Linux Utility like 'ls' in C Developing Linux Utility - Part II Arranging Output in Alphabetical Order Example $ ls -l total 148 ...
1
2,344
Recently I have been writing a lot on Linux files and functions related to file I/O. So, extending the discussion further in this article lets discuss two more important Linux functions : A) access(const char *pathname, int mode) This function checks whether the calling process can access...
0
2,296
In this tutorial, we'll be looking at the code structure of the 'echo' utility and will try to understand how it works, for those who are unfamilliar with the 'echo' utility, its one of the most basic and most useful utilities in a shell it prints out its arguments on the standard output, if you...
0
2,292
Environment variables can be thought of as a name value pair that affect the behavior of the processes running on an operating system. For example, to know the value of environmental variable PATH in my system, I do : -laptop ~ $ echo $PATH ...
0
2,241
This time we checked Apache HTTP Server with PVS-Studio. As we had expected, we found errors there. The errors are few. We expected this either. Other developers come across this situation too while testing PVS-Studio on their projects. Unfortunately, the first conclusion you would like to draw...
0
2,233
We will discuss the concept of Macros. A Macro is a name given to a piece of code or to a value. Whenever the macro is used in the code, it is replaced by its value at the very first stage (preprocessing stage) of compilation process. They are defined using '#define' directive. For...
2
2,214
In this article, we will discuss different implementations of sleep functions that had flaws to understand how sleep function evolved. Before discussing the sleep function implementations, lets first understand briefly the following two functions : alarm() function From Linux Man page : ...
0
2,194
The fork() unix API provides mechanism to spawn a new process from an existing process. This function is called once in a program but it returns twice. Once in parent process and once in its child process(the new spawned process becomes the child process).The return value of this function in child...
0
2,122
We all have been using Functions since we stepped into programming. Numerous times we have called a function with some arguments to it. We all know that the basic declaration of a function is : <return-type><function-name>(<comma seperated list of arguments>); For example : int func(int...
0
2,068
If you are a developer then you would definitely be aware of the concept of temporary files. Temporary files, as the name suggest is temporary in its persistence. Either a process creates a temporary file to hold data for certain time or to pass information to another process. An ideal process...
0
2,049
Data files are very essential part of in computer programming. The data we use while programming using the variables of different data types, are unavailable after the program execution. So,there is no way to retrieve the data if we further need. Here comes the necessity of data files. FILE...
0
2,044
Continuation of Developing Linux Utility like 'ls' in C series. In the first part we studied a code that was developed to behave like a basic ls utility. Here in this part I have extended the code to give output in alphabetical order. The code Here is the code : ...
0
1,953
This is the fourth post in which I want to share with you some useful observations on error patterns and the ways of fighting them. This time I will touch upon the subject of handling rare and emergency conditions in programs. While examining a number of applications, I came to a conclusion that...
0
1,881
If you work 3-4 hours daily on coding in C/C++ then there ought to be some programs, logics, tricks, tips etc which you come across daily. Some are new to only you while others are interesting enough to be shared. Here in this article, I am going to share one interesting program and how I went...
0
1,873
Type casting is an explicit type conversion requested by the programmer to achieve its objective in the program. During any kind of computations involving various data variables of different data types, leads to the need of typecasting. Syntax used: (Data-type-2)<variable/expression of data...
0
1,872
Continuing the previous discussion that we did on Unix Threads (Basics) , today we will discuss the concept of 'Thread Synchronization'. Going through a quick recap, we now know that threads are used to make calls to functions non-blocking (asynchronous). One important point that we did not discuss...
0
1,871
Abstract Introduction The interview text References Abstract This is an interview with Dmitriy Vyukov - the author of Relacy Race Detector (RRD) tool intended for verifying parallel applications. In this article you will learn about the history of creating RRD, its basic abilities and...
0
1,865