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

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

Array of pointers in C Programming

Example: Write a program to assign the address of array elements to pointer variable and print the array element with address. #include int main () { int arr[] = {10, 20, 30}; int i, *ptr[3]; for ( i = 0; i < 3; i++) { ptr[i] = &arr[i]; // assign the address array element to ... Read more

Functions in C Programming

In a C programming language a function is a group of statements that together perform a special task. In every C program has at least one function, which is main(). In a C library has a numerous predefined or built-in functions. For example, strcat() to concatenate two strings, main() from where program execution starts.  In a C programming … Read more