Category Archives: C Tutorials

How to Generate Random Number in C and C++?

Here you will get program and learn how to generate random number in C and C++. We can use rand() function to generate random number. It is defined in stdlib.h header file. It generates a random number between 0 and RAND_MAX (both inclusive). Here RAND_MAX is a constant whose value depends upon the compiler you are… Read More »

Format Specifiers in C

In this article you will get list of format specifiers in C. Format specifier is used to specify the data type while reading or writing. For example if you want to print value of an integer type variable then you have to use %d in printf() function. Take below example.

  As you can… Read More »

Dangling Pointer in C

Here you will learn about dangling reference and dangling pointer in C. In computer programming, memory is allocated for holding data object. After the work is done the memory is deallocated so that this memory can be used to store any other data object. Also Read: void pointer in C What is Dangling Pointer? While programming,… Read More »

Difference Between break and continue in C

In this tutorial you will learn about difference between break and continue in C. The break statement is used in switch or loops and continue statement is used only in loops. When break statement is encountered it immediately stops the switch or loop execution. When continue statement is encountered, all the statements next to it are skipped… Read More »

Difference between C and C++

In this tutorial you will learn about difference between C and C++ language i.e. C vs. C++. It is one of the most commonly asked question in technical interviews. C programming language was developed by Dennis Ritchie in the year 1972 while C++ programming language was developed by Bjarne Stroustrup in the year 1983. C++… Read More »

Difference between Structure and Union

In this tutorial you will learn about difference between structure and union.   Structure and union both are user defined data types which contains variables of different data types. Both of them have same syntax for definition, declaration of variables and for accessing members. Still there are many difference between structure and union. In this tutorial we will take… Read More »

Union in C

Union is a user defined data type which contains variables of different data types. Or we can say that, union is collection of dissimilar type of elements or data. The concept of union is taken from structure so the syntax of union is same as structure. Union can be defined using keyword “union” as shown… Read More »

C Enumeration

C Enumeration or Enumerated Data Type C enumeration is a user defined data type which consists of a list of names and each name corresponds to an integral constant. It increases the program readability as names are easy to read and maintain. Enumerated data type can be defined in C using “enum” keyword. The syntax… Read More »