C Programming Tutorials

C Programming Tutorials And Articles
  Title / Author Replies
The below code is a calculator in plain C. It does not take into account the operability of bodmas but just one operation at a time. The main thing in the source code below in the scanf which scans the input as number symbol number just as in case of normal calculator. #include<stdio.h> ...
Refer to the recent articles on Understanding File Handling Functions in C & Understanding Advance File Handling Functions in C C communicates with files using a new datatype called a file pointer. This type is defined within stdio.h, and written as FILE *. A file pointer called output_file is...
The article discusses about all the number formats viz Binary, Decimal, Octal, Hex and BCD (Binary coded decimal) and conversion from Decimal to Binary, Octal and Hex and also the reverse conversion. Binary A numbering system based on 2 in which 0 and 1 are the only available digits. ...
InFix to PostFix Introduction Infix Expression : Notation in which the operator separates its operands. Eg (a + b) * c. Infix notation requires the use of brackets to specify the order of evaluation. Postfix Expression :
Refer to the recent articles on Understanding File Handling Functions in C & Understanding Advance File Handling Functions in C Opening A File Before we can write information to a file on a disk or read it, we must open the file. Opening a file establishes a link between the program and the...
Hello to one & all, I did a little bit of programming this weekend (I got myself a new Xbox 360!) .... but not satisfied with the Gaming monolith, I decided to do some game programming myself. So, I implemented that very famous game played by everyone who had access to a computer in the early 90's...
How to make your program to be fast. 1. Use Pre Increment or Pre Decrement in place of Post Increment or Post Decrement operator. i.e. use ++i or --i in place of i++ or i--. Because ++i operator take increment and save it i.e. One CPU Instruction is required for it. and in case of i++...
Introduction Here I am going to give a simple example of addition, substraction, multiplication etc to check overflow/underflow so that we can minimize buggs/defects in our code The code In your project/product or any place, If you have some operation like Addition, substraction...
Stack memory Let's suppose there is nothing on the stack to begin with. One of the functions either the calling function or the called function depending on the calling convention would start a stack. Lets take a very simple C / C++ program to see how things would work. int func(int i) {...
Introduction After long day's discussion, bool was made as built-in type. Before it lot of other proposals came for bool. There were following proposals. Proposal 1: bool can be implemented by typedef typedef int bool ; It works fine but problem is that if someone overloads functions...
Integers is a fundamental data type in a C program, They are used to represent a finite subset of mathematical integers, C Provides us with a suite of functions, and quite a lot of modifiers for manipulating these integers , but if these functions and modifiers are not used properly and carefully...
Function pointers are pointers that can hold the address of a particular type of functions. These pointers, once initialized can be used to call the function whose address they are pointing to. Declaring Function Pointer A function pointer can be declared in following way : <return type of...
In this article, I'll present some interesting 'C' problems for which I will not provide the answer. If you are not bale to solve any problem, then just leave a comment here so that everybody is benefited when the problem is discussed. Problems 1) Will the program execute without any problem?...
Signals are the interrupts. They are a way of providing asynchronous events. For example a user typing ctrl-c on terminal to stop a program. Most of the programs need to handle signals. Every signal has a name like SIGxxx. For example : SIGALRM is the alarm signal that is generated when the timer...
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...
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 : ...
There are a certain functions in C, which if used in a particular combination may cause problems. These problems are due to the conflicting behaviors of the functions. In this article, we will understand the problem caused by using one such combination of functions scanf() and fgets()/gets(). ...
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...
GCC provides quite a lot of builtin functions. These functions are part of standard C offered by the compiler and may come in various variants as per the gcc. These are also termed as hardware specific functions which are internally implemented in assembly or we can say machine instructions, with...
I wanted to make a remake of my previous BAD versions of these 2 functions. I think they are working great now, and they're portable the same as the originals from STD library. ATOI /******************************************************************************************************** ...