Variables In C Language

An entity that may vary during program execution is called a ‘Variable’. Variables names are names given to locations in memory. These locations can contain integer, real or character constants. In any language, the types of variables that it can support depends on the types of constants that it can handle. Variable names are just symbolic representation of the memory location. Continue reading Variables In C Language

C Program to Use Printf(); Function Without The Semicolon

We all know, every statement in C is terminated by semicolon (;). The same apply to printf(); function.

Suppose we are going to print Lightning Code on the screen than statement for it will be printf(“Lightning Code”); but what if we want to print it without the semicolon after printf. Think about it, how can you do it, I know, you know how can but you did’t notice it.

Let me give you a hint, when we use if(); statement to condition something, we never use the semicolon inside the parenthesis. Now I am sure you make it out.

Let’s Have Ah Look at Program ►► Continue reading C Program to Use Printf(); Function Without The Semicolon

C Program to Find Factorial of a Number

Hello Readers 🙂 Hope you are getting valuable posts. If you have any query or want to know about any program, Let Me Know, I’ll love to help you out. And Keep Learning.

Now I am going to write a program to find the factorial of a number. Factorial of a number is the multiplication of all numbers lower than it and greater than zero as factorial of 5 will be 5*4*3*2*1=120.

Let’s Make The Program ►► Continue reading C Program to Find Factorial of a Number

C Program to Print Out Fibonacci Series Using Recursion

As Ih told you about Fibonacci Series in my previous post. Here I am writing the program to print Fibonacci Series Using Recursion. Recursion is a technique in which function call itself. A program that calls itself is called recursive program.

Look at the Program  ►► Continue reading C Program to Print Out Fibonacci Series Using Recursion

C Program to Print Out Fibonacci Series upto N Terms

Really for coding one also must learn the Mathematics. There are many programs out there which are totally based on mathematics questions. And I hate maths 😦 Love to coding only 😉

Well Let Face It. Lets make a program to print out Fibonacci series up to N terms. A series of numbers in which each sequent number is sum of its two previous numbers is known as Fibonacci series and each numbers are called Fibonacci numbers.. For example we have to print up to 5 then the series will be 0,1,1,2,3, here every number is the sum of last two numbers.

Lets Have ah Look at the Program  ►► Continue reading C Program to Print Out Fibonacci Series upto N Terms

C Program to Convert Numbers Into Words

Lets make a program for converting number into words. I em not talking about converting numbers into their ASCII values, what I mean is juss like convert 1234 to “One Two Three Four”. I found this program useful and a better one to boost your logical skills.

Have ah Look at the Program ►►

void main()
   int num,n,i=0;
   char *ptr[1000];

   printf("\nEnter any Number : ");

   while(num) {


   switch(n) {

   case 0 :

   case 1 :

   case 2 :

   case 3 :

   case 4 :

   case 5 :

   case 6 :

   case 7 :

   case 8 :

   case 9 :
} // While close brace

for(int j=(i-1);j>=0;j--)

Explanation ►►

So what is done in the program is first we declared a string pointer (*ptr[1000]), for storing the words of number in the pointer and then print them in reverse order to get the right output. Then conditioned the while loop as while(num) it will execute till the number comes to zero.

After the user entered the number it will store in the variable num, now it will go through the while loop till it does not have the value of zero. In while loop the first statement (n=num%10) will take the last digit of the num and will assign to variable n then we use the statement num/=10; (num=num/10;) to remove the last number from the variable num. It;s like suppose user entered 1234 then by first statement 4 will be stored in n as %(modulus) operator always return the remainder and then the number will be divide by 10 to remove the last digit(4), after the second statement the num value will be 123 and so on.

Then when we got the value in n we go to the switch statement then the variable n is compared with the cases and the matched case will be execute. As the value of n is 4(suppose) the case 4 will be execute and the string “Four” will be stored in char pointer(ptr) following the ptr[i++]=”Four”; statement. We use i++ inside the dimension of the array pointer because after every string stored the value of i will be incremented to point the next location in the char pointer to store any other string. The i++ is the post increment that means after using the variable (assigning the value to the location) it will increment the value of i by 1.

This process will be done for all digits and once the number becomes zero, means there is no digit left, the while loop will be terminate and then we will simply print the words in reverse order(because the digit last in the number is taken first) to make right form of the words.

Here in for loop we assign j as j=i-1, because the last case that will execute will increment the value of i, that means the i will be pointing to the empty location of the char pointer. By taking i-1 it will point to the last location of the char pointer.

C Program to Compare Two Strings Through User-Defined Function

Strings are another good feature of C. They provide a great way to store characters, not in really, in actual C Program stores the ASCII Values of characters that’s why there is no any non-numeric data-type in C. All in hidden, access and manipulate through numeric values. In other words, Strings are arrays of characters.  

There are many functions for strings and to compare two strings there is also strcmp(str1,str2); function. Which if the two strings are equal gives the value 0(zero) and otherwise return the ASCII value difference between first non-matching characters.

Lets do it with some trick to eliminate the variables and shorten the size of the program.

Lets Do It with the User-define Program ►► Continue reading C Program to Compare Two Strings Through User-Defined Function

C Program to Find The Second Largest Element Of An Array

Arrays provide the great way to store the values. And plays ah important role in C. I made many programs on arrays. And as we know array elements are always store in Contiguous Memory Location so it’s always great to combine array with pointers that makes accessing and manipulating array more handy. 

You might made the program to find the largest element of array. I come with the code to find the second largest element and also the use of macros in the program to run it more faster and avoid re-righting the same line again and again.

Lets Have ah Look at the Program ►► Continue reading C Program to Find The Second Largest Element Of An Array

spreading the power of programming …