Member-only story
C++ Knowledge in Coding Interview
Some useful C++ knowledge and examples that may be used/asked in a coding interview
Table of Contents
- Variables definitions, assignments, and initiations
- Type conversions
- Pointer
- Object-Oriented Programming
- STL
- Other common usages
- Explanation of keywords
Variables definitions, assignments and initializations
Integers
int a;
int a = 5;
int a(5);
int a{5};Char
char c;
c = 'a';
c = 97; // same as c = 'a'; cout << c will print 'a' as well.char c = 'a';
char c('a');
char c{'a'};
Float and double
float f;
f = 5.0f;float f = 5.0f;
float f(5.0f);
float f{5.0f};double d;
d = 5.0;double d = 5.0;
double d(5.0);
double d{5.0};
char str[] = "string"; //\0 is added automatically
str = "rope"; // not ok!







