Skip to content

Tag Archives: cpp-data-types

Consider the below C++ program and predict the output. #include <iostream> using namespace std;    int main() {     float f = 0xffffffff;     unsigned int x… Read More
C/C++ has very loose definitions on its basic integer data types (char, short, int, long, and long long). The language guarantees that they can represent… Read More
Most of the times, in competitive programming, there is a need to assign the variable, the maximum or minimum value that data type can hold,… Read More
NaN, an acronym for Not a Number is an exception that usually occurs in the cases when an expression results in a number that is… Read More
Type Inference refers to automatic deduction of the data type of an expression in a programming language. Before C++ 11, each data type needed to… Read More
Let us have a look at following code snippet in C/C++. C++ // An Unsigned char example #include <iostream> using namespace std; void fun1() {… Read More
Although polymorphism is a widely useful phenomena in C++ yet it can be quite complicated at times. For instance consider the following code snippet: #include<iostream>… Read More
In C, it is possible to have array of all types except following. 1) void. 2) functions. For example, below program throws compiler error int… Read More
Enumeration (or enum) is a user defined data type in C. It is mainly used to assign names to integral constants, the names make a… Read More
Predict the output of the following C program.  C #include<stdio.h> int main() {     float x = 0.1;     if (x == 0.1)         printf("IF");     else if (x… Read More
Predict the output of following program: Can % be used with floating point numbers in C++? #include <iostream> int main() {     float f = 9.9f,… Read More
Write a C function ftoa() that converts a given floating-point number or a double to a string.  Use of standard library functions for direct conversion… Read More
Some data types like char , short int take less number of bytes than int, these data types are automatically promoted to int or unsigned… Read More

Start Your Coding Journey Now!