Category : types

I know that C and C++ are different languages. Code – C #include <stdio.h> int main() { printf("%zu",sizeof(‘a’)); return 0; } Output 4 Code- C++ #include <iostream> int main() { std::cout<<sizeof(‘a’); return 0; } Output 1 https://stackoverflow.com/a/14822074/11862989 in this answer user Kerrek SB(438k Rep.) telling about types in C++ nor mentions char neither int but ..

Read more

When I run the snippet below, it prints out: int& int __cdecl(void) I was expecting the second line to just be int Why is this happening? What could I do to fix it if it were inside a templated function that takes pointers or iterators so I couldn’t use std::remove_pointer. #include <type_traits> #include <iostream> int ..

Read more