C Programming Tutorials

C Programming Tutorials And Articles
  Title / Author Replies
Views
File Splitter is a very useful utility application for downloading . User want to download and store the downloaded files into Floppy disk , Its possible only if the downloaded file size is Less than or equal to 1.38 MB , If file size is more than the floppy disk size then File Splitter is...
2
11,734
The code to find upper and lower diagonal of 3x3 matrices #include<conio.h> #include<stdio.h> void main() { int a,i,j,k; clrscr(); printf("\n Enter a Matrix 3x3:\n\n");
2
4,084
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...
5
2,903
Introduction The idea is simple just to test whether the expression contains correct sequence of brackets or not. void main() { char arr; char *top; int loop=0,i,l,binary;
2
1,800
Introduction I always like smilies and the ASCII characters can behave like good smileys and so I wrote a small utility to get all tha ASCII values of the characters and I can easily add them anywhere I prefer The Code int i; FILE *fp; fp = fopen("c:\\code.txt","w"); for(i=0;i<256;i++)
2
3,440
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++...
14
4,713
Mostly people are using this algorithm to compute matrix multiplication: #define n 1000 int main() { int a,b,c; c=0; for( i=0;i<n;++i) {
8
28,495
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;
8
2,898
#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,285
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...
5
2,808
Calculating the factorial of a number is a basic excercise while learning to program in C, many of us have done it iteratively, it can also be done recursively. I am posting both iterative and recursive versions below. /* Recursive Version */ unsigned int recursive_factorial(int n) ...
30
34,571
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...
5
4,660
I recently faced a problem regarding these 2 Escape Sequences. So, I thought I should share the difference between these two to clarify to all who may hay have confusion like me. Thanks to Shabbir too...... The Difference There are a few characters which can indicate a new line. The usual...
6
39,871
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);
4
3,203
The code below swaps two nodes in the linked list. The swap operation can be helpful in sorting a linked list and so its very important how to swap the nodes of linked list. Swapping in normal arrays is swap of the data but in linked list its the pointers change and so there is just change in...
7
37,745
As the topic says, self printing programs are nothing but they reproduce themselves as output. Such programs are referred as Quines from the name of the logician Willard van Orman Quine who introduced the concept. I said an 'Ah!!!' when I heard about Quines for first time, spent more hours to...
3
7,745
This program takes the elements from the user in random order & then arranges it in form of Binary Search Tree.It then asks user for traversal #include<stdio.h> // including headerfiles #include<conio.h> #include<stdlib.h> struct tree ...
0
50,116
Pointer and reference maybe same at assembly level. Try an experiment : # include<stdio.h> int main() { int i =90; int *pointer; int &reference = i; // Line 6
4
3,826
Code for Decimal To Binary Conversion #include<stdio.h> void main() { int i,n1,t,w,a,i1=0; float n,f2; clrscr(); printf("PROGRAM FOR DECIMAL TO BINARY CONVERSION\n");
5
76,251
The code to swap two variables using macro expansions #include<stdio.h> #include<conio.h> #define SWAPE(x,y) int t;t=x;x=y;y=t; main() { int a,b;
13
32,749