C Programming Tutorials

C Programming Tutorials And Articles
  Title / Author Reverse Sort Order Replies
Views
Today while solving a problem, I had to convert integers to string in C to use its indexing capabilities. One simple solution was to use sprintf, which can be done in 2-3 lines, but i was temped to solve this problem without any string manipulation functions. The Code // Change a positive...
4
5,030
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,271
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...
3
2,823
Introduction This artcile talks about Design By Contract Technique with an example to show how it can be used in an Application. Background Most application problems arise because of inappropriate handling of data obtained from external systems that could be a application user, remote...
9
5,583
Introduction This article talks about different ways of handling Abnormal Condtions or Errors that occur or Invalid Data receiving by an Application. These Errors are something, the programmer expect to occur in their Applications. Depending on the specific circumstances, below are some...
3
5,142
Introduction This article talks about some general tips while using pointers in an Application. Background While working with different kinds of errors, generally detecting an error is easier than fixing it. When it comes to pointer, the error is usually the result of a pointer pointing...
6
5,836
Conditional statements are statements, which are executed depending on some condition being satisfied as true or false. In this tutorial, we will try to learn some conditional statements which include: If-else, switch, break and continue which controls the behaviour of loop to some extent. if...
0
1,500
Array is a data structure consists of a group of elements of same data type. We can think it as collection of variable of similar data type. Array prototype: Data_type array_name Example: Suppose you have a team of 10 employees. Id is given for every employee. You want to store id, age...
0
1,216
Function is a block of statements that performs a specific task. It is reusable portion of the code and a very effective way to modularize your program. For example, you may need to perform different arithmetic operations in your program like addition, subtraction, multiplication and division....
0
1,281
Newton Raphson Interpolation Formula implementation in C. #include <stdio.h> #include <conio.h> #define N 100 float comb(float,int); /*****************************************************************/ /***** Newton-raphson-interpolation formula implementation *****/ /***** This...
4
9,901
#define f(a,b,c,d) (a>b?(a>c?(a>d?a:d):(c>d?c:d)):(b>c?(b>d?b:d):(c>d?c:d))) #include<stdio.h> #include<conio.h> void main() { int a, b, c, d, k; clrscr(); printf("Enter the value of a, b, c, d\n");
10
3,247
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; ...
2
4,355
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...
13
3,941
At times certain tasks need more time to execute and when multiple such tasks are desired then blocking on a single task is not a good practice. To Understand, Think of a program that provides some service but this service takes time to execute. Now, if you want this service again and again then...
0
1,701
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?...
20
5,021
The motivation behind writing this article came from the fact that there are still many books/tutorials/softwares etc where I have seen 'void main' being used instead of 'int main'. Still most of the C/C++ newbies are taught to start practice coding with 'void main'. Even I started practicing C in...
2
3,225
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;
2
2,959
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...
2
2,923
A lot many times you would have used a Linux command with some arguments to it. Like : cp -r /home/user/Desktop/abc /home/abcrm -rf abcIn the above examples, 'cp' or 'rm' are the name of binaries (written in 'C') while the rest of the stuff is the command line arguments to the respective...
2
4,663
If you are an experienced C/C++ programmer then you must have definitely observed some weird behaviors of code in certain situations. These weird behaviors can be due to various reasons but most of them are because of stack corruption. For all those who have no idea about what stack corruption is,...
0
4,348