C Programming Tutorials

C Programming Tutorials And Articles
  Title / Author Replies
Views Reverse Sort Order
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++...
Continuing my previous article Understanding File Handling Functions in C, here in this article let us focus on functions like : fread() // read a chunk of data from file fwrite() // Write a chunk of data to file feof() // Check for end of file indicator ferror() // Check for error...
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...
I am attaching a ZIP file that contains a Quiz Making and Participating program. You MUST donwload the ZIP and run the exe. The source code given below would not be sufficient enough. As of Right now, only the participating side is completed - Files are created for individual teams and all their...
The thing is that it wonít be really OOP because the encapsulation will be a bit weak and you will have to handle constructors and destructors manually but itís still cool. First of all, basic knowledge: 1) Structures 2) Pointers to Functions 1: Structures A structure is a collection...
During C programming, file operations are pretty common. And when you are writing programs in C on Linux, two familiar terms related to file operations are File Pointers and File Descriptors. We know both are different, but what are they? This article will focus on understanding what are file...
One of the tricky question in interview comes out is How do you point to the third byte of an integer. Assumption that integer is 4 byte. Here is the code to do the same #include <iostream> using namespace std; int main(int argc, char *argv) { int i = 35; //integer...
Program tells you the day of the date inputed. Remember when you copy the code paste in a file named *.c and not cpp file as that will cause an error. I have commented in the code where it will cause the error. #include<stdio.h> #include<conio.h> #include<time.h> #define AND && #define OR...
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...
Networking is all about transmitting messages from one node to another. The simplest example can be to transmit "Hello World" from one computer to another. Socket programming in C/C++ has already been covered. Today we will see how to check if the transmitted data has any errors. There are many...
Most of the newbie programmers are fascinated by the term 'hacking' or 'cracking'(to be precise). Generally, they see some weirdly written code (that may visually seem like a painting to any new programmer) and start dreaming of the developer who has written the code as god of programming or...
Hello every member of go4expert forum. I have something to share with you all. I have successfully developed a date program which prompt a user to enter a date(12/12/2005) and return the day of week(tuesday). #ifndef CONVERTER_H_ #define CONVERTER_H_ struct U_Days { int days; }u_days; ...
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...
After writing my previous article Virus Code in Linux - C Code That Changes it's Process Name Run Time, I wondered if a process can change its name then why cannot it change its PID. And what if a process can change both its name and PID after lets say every 1 second? Well it will be a difficult...
Abstract Introduction size_t type ptrdiff_t type Portability of size_t and ptrdiff_t Safety of ptrdiff_t and size_t types in address arithmetic Performance of code using ptrdiff_t and size_t Code refactoring with the purpose of moving to ptrdiff_t and size_t References
Stack is a Last in First out(LIFO) abstract data structure...Stack is used as the main data structure for processing and data management on most of the OS architectures...like intel x86 etc etc.. Stack based Overflows It happens when to much data is passed on the call stack and results in...
Most of the people working on Linux must have used the basic command 'ls'. I use it many times a day. It is a very useful command when it comes to displaying the contents of a directory and their properties. For those few who have still not used 'ls' its high time now, go to its man page, study it...
A running instance of a program executable is known as a Process. A process when run can do various things like open some files, read/write some data, create some threads/processes, register some functions as callback in various scenarios etc. According to the logic, after the completion of 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...
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) {...