Skip to content

c++

c++

malloc vs calloc

Reading Time: < 1 minute

malloc vs calloc differences provided here:

When calloc is used to allocate a block of memory, the allocated region is initialized to zeroes. In contrast, malloc does not touch the contents of the allocated block of memory, which means it contains garbage values. This could potentially be a security risk because the contents of memory are unpredictable and programming errors may result in a leak of these contents.Read More »malloc vs calloc

c++

Typedef in C++

Reading Time: < 1 minute

The declaration that follows the keyword typedef is otherwise usual simple declaration (except that other type specifiers, e.g. static, cannot be used). It may declare one or many identifiers on the same line (e.g. int and a pointer to int), it may declare array and function types, pointers and references, class types, etc. Every identifier introduced in this declaration becomes a typedef-name rather than an object that it would become if the keyword typedef was removed.

Read More »Typedef in C++

c++

Virtual Functions in C++

Reading Time: < 1 minute

Virtual functions in c++ is ,if you want to execute the member function of derived class then, you can declare  a function  in the base class virtual which makes that function existing in appearance only but, you can’t call that function. In order to make a function virtual, you have to add keyword virtual in front of a function.

Read More »Virtual Functions in C++