Command Line Argument in C Programming

In C programming often a situation may come where we want to pass the information into a program during the execution of the program. These values are called Command Line Arguments(CLA). The “main()” function handles the command line argument. Syntax: int main( int argc, char *argv[] ) { } Here, argc refers to the number of arguments … Read more

Ternary Operator in C Language

This operator also known as conditional operator . It is similar to if-else statement. Syntax of ? operator Expression1 ? Expression2 : Expression 3; There are three expressions in ? operator, Expression1, Expression2, and Expression3 . The value of a ? expression is determined like this − If Exp1 is true, then Exp2 is evaluated. … Read more

if else statement in C programming

In the C language decision making statement is executes if the given condition is true otherwise conditional block will never execute. In C language non-zero and non-null values are consider as true, and zero or null values are consider  false. if statement Syntax of an if statement − if(expression) { statements; } In a if statement if the expression result is … Read more

Addition of Two Matrix in C Programming

A Matrix is Two dimensional array that have number of rows and columns. Addition of Two Matrix in C Programming is very easy. To write program for adding two matrix is same as we perform matrix addition in mathematics. To Add Two Numbers rows and columns of both matrix should be same. Element of each … Read more

Addition of two numbers in C Programming

Addition of two numbers in C Programming is basic and simple task. We can create it very easily. Writing a program is based on Algorithm. An algorithm is step by step description of program. So before writing program we must write algorithm to develop this program. There are different ways to represent an algorithm 1 … Read more

Count Repeated Elements in an Array in C Programming

Count Repeated Elements in an Array in C Programming is generally asked in interviews. This problem can be solved in any language. Here we will discuss algorithms to count repeated elements and implement them in C programming. What is Repeated Elements Repeated elements are elements that occur more than one time in a list or … Read more

GCC installation on linux unix

In a Linux or UNIX, to check whether GCC is installed on your system  enter the following command in the command line − $ gcc -v If GCC compiler installed on your system, then it should print a message as follows − Using built-in specs. Target: i386-redhat-linux Configured with: ../configure –prefix=/usr ……. Thread model: posix … Read more

Reading a File in C Programming

Reading a File To read a  file there are following  function available: Function fgetc():  Function fgetc() is used to read a single character at a time from the input file. The syntax of this function is −             Syntax :                int fgetc( FILE * fp ); Functions fgets():  Functions fgets() is used to reads string from input … Read more