Primitive Data Types in C Programming

1. What is data type in C Data type specifies what type of data a variable can hold. There are four category of data type in C language.  They are as follows: Types Data Types Basic (Primitive) data types int, char, float, double Enumeration data type Enum Derived data type pointer, array, structure, union Void … Read more

Command Line Argument in C Programming

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

File handling programs in C Programming

Example : Write a C program to copy the contents of one file to another file.

OUTPUT

Example : Write a C program to appends the content of file at the end of another file. Or  Example : Write a C program to merge two files into third file.

Example: Write a C program … Read more

Writing to a File in C Programming

To write on a file there are following  function available:  Function fputc() : function fputc() write individual characters at a time to the file. The syntax of this function is – Syntax :                int  fputc( int c,  FILE *fp ); Function fputc()  returns the written character written on success and  if there is an error it will return … 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

File Handling in C Programming

A file represents a sequence of bytes and these file’s is used to store information. There are various different operations that we can be performed on a file are: Creation of a new file (fopen with attributes as “a” or “a+” or “w” or “w++”) Opening an existing file (fopen) Reading from file (fscanf or … Read more

Arithmetic Operation With Pointer

In a C programming, we can also perform arithmetic operations with pointer. There are four arithmetic operators that can be performed with pointers: Increment (++) Decrement ( — ) Addition ( + ) Subtraction ( – )  For a simple variable int a=3;a++; //print 4Increment integer value by one. Pointer is a variable which can … 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.

OUTPUT