Category Archives: C Tutorials

Difference between float and double

Here you will learn about difference between float and double i.e. float vs double. These are two commonly used floating point data types in programming languages like C, C++, Java, etc. Both float and double are used to store values with decimal point but there are some differences between them that are mentioned below. float… Read More »

How to Convert String to int in C and C++

There are different ways to convert string to int in C and C++. Like using inbuilt function or writing custom code. Lets take a look on each of them one by one. The programs below are written in C but the same concept will work for C++. Ways to Convert String to int in C… Read More »

Difference between Declaration and Definition in C

Mostly beginner programmers are not aware of difference between declaration and definition in C. In this tutorial I will explain the both terms clearly. Declaration It tells compiler about the name and type of the identifier (variable, function, array, etc.). Memory is not reserved in this case. Variable Declaration

In above example we declared… Read More »

Solve error: lvalue required as left operand of assignment

In this tutorial you will know about one of the most occurred error in C and C++ programming, i.e. lvalue required as left operand of assignment. lvalue means left side value. Particularly it is left side value of an assignment operator. rvalue means right side value. Particularly it is right side value or expression of an assignment… Read More »

Lexical Analyzer in C and C++

Here you will get program to implement lexical analyzer in C and C++. Compiler is responsible for converting high level language in machine language. There are several phases involved in this and lexical analysis is the first phase. Lexical analyzer reads the characters from source code and convert it into tokens. Different tokens or lexemes… Read More »

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 »