C Programming Tutorials

C Programming Tutorials And Articles
  Title / Author Replies
Views Reverse Sort Order
Introduction In computer science a search algorithm is a technique of finding a particular item among a collection of items. Searching for data is the second most common activity (after sorting data) necessary for creating many types of programs. Sequential Search In this technique we...
This is the third article where I will tell you about a couple of new programming methods that can help you make your code simpler and safer. You may read the previous two posts here and here . This time we will take samples from the Qt project. Introduction It was not accidentally that I...
Program to find max(x,y) or Min(x,y) without using any relational and logical operator. int maximum(int x, int y) { int fNum,temp,num; num = x; num = y; temp=fNum; return( temp);
I have been writing many articles on C/Linux explaining concepts, APIs and their usage etc. This time I thought to write on a fundamental concept that every newbie should be well aware of in order to become a good coder, ie 'Good coding practices'. I have 3-4 broader level points to make here. I'll...
Abstract Introduction PC-Lint tool VivaMP tool Static analysis implemented in Intel C++ compiler Conclusion References Abstract
The phenomenon of stuffing excessive data which is beyond the capacity of the allocated memory is known as buffer overflow. In Simple words we can say that for lets say 'n' bytes of memory, if we try to store any number of values which is greater than 'n', then the values beyond the nth value will...
Suppose a system call was blocked due to some reason (like waiting for a read of some data on terminal) and during this time a signal occurs. Do you know what happens in this scenario? In this article we will discuss the impact of signals on system calls. System calls are different from...
Continuation of Shell-coding basics..I suggest a glance over it before you start reading this.. Testing We'll be using a simple C program to accomplish our task. test.c // #include<stdio.h> we will not be needing this as we are not using any functions from the C library...Just basic...
Before we start with Non re-entrant Functions, Can you guess the problem with this piece of code : #include<stdio.h> #include<signal.h> #include<unistd.h> #include<stdlib.h> int flag; char *s;
Format strings are the strings mainly associated with printf's set of instructions (like printf,fprintf etc..) which basically stands for print format.... These functions accept several arguments and put them on the stack..and as a format specifier is noted in the string the function pops the data...
Introduction A lot of us use TC in our colleges. Today I will share with you Two ways to have fun in lab with your teachers. ;) Background Trick I In the first way, you will create an error in any wokring code just by adding one or more numeric letter in it. There will be only one...
Program prints the month without using any system related information but just making some simple calculations of days from the reference day 1/1/1900 as Monday. #include<stdio.h> #include<conio.h> #define Y 1900 /*1/1/1900 Monday*/ void days(int ,int ); void display(int , int );...
Error handling has always been dominantly vital in programming. It has become a bit more sophisticated with the object oriented languages, however even in the system programming language like C, error handling is being offered in its own simple ways. Introduction To swim deep into the...
Pretty sure, one must have used the datatype ‘float’ numerous number of times since the day one has started programming. However, there are many times, when we mishandle floats and doubles, or get unexpected results while using float variables or find ourselves being perplexed while using floating...
Pointer Pointer is a declared like a variable, but it's not an ordinary variable, it's a fancy variable, that can store address of the another variable. Pointer is very much useful for allocating memory at run time , that's dynamic allocation. Pointers are said to "point to" the variable whose...
This is the code I wrote in my college days and dont quote me on this if something does not go as expected. #include<stdio.h> #include<ctype.h> #include<conio.h> void main() { int c,i,letter;
As the name suggests, volatile specifier indicates the compiler that the value of the variable is volatile i.e. it can change unexpectedly. But, the question comes why do we need to even specify that a variable value is volatile. The Requirement for volatile specifiers Our compilers...
The below program calculates the largest no among the no entered but it just calculates as user inputs them. This can be used with files and as you move ahead in file you can store the max and the min value in a variable when parsing the file. #include<stdio.h> int largest(int,int); void...
In this article we'll be learning how we can improve our C code by using Macros instead of functions. How simple functions can be converted into macros to save on some CPU instructions. Some basic knowledge of C and a little bit Assembly is considered as pre-requisites. The Code We'll be...
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...