Left Shift and Right Shift Operators in C/C++

George John
Published on 24-Oct-2018 13:57:27
Left ShiftIn the left shift operator, the left operands value is moved left by the number of bits specified by the right operand.Here is an example of left shift operator in C language, Example Live Demo#include <stdio.h> int main() {    int y = 28; // 11100    int i ... Read More

Difference between Structure and Union in C

Chandu yadav
Published on 24-Oct-2018 13:54:59
StructureStructure is a user defined datatype. It is used to combine different types of data into a single type. It can have multiple members and structure variables. The keyword “struct” is used to define structures in C language. Structure members can be accessed by using dot(.) operator.Here is the syntax ... Read More

What does '?' do in C/C++?

Arjun Thakur
Published on 24-Oct-2018 13:51:27
The operator ‘?’ is known as ternary operator as it requires three operands to act upon. It can be represented by “ ? : ”. It is also known as conditional operator. The operator improves the performance and reduces the lines of code.Here is the syntax of ternary operator in ... Read More

Purpose of Unions in C/ C++

Ankith Reddy
Published on 24-Oct-2018 12:58:50
Union is a user-defined datatype. All the members of union share same memory location. Size of union is decided by the size of largest member of union. If you want to use same memory location for two or more members, union is the best for that.Unions are similar to structures. ... Read More

C++11 features in Visual Studio 2015

George John
Published on 24-Oct-2018 12:54:58
C++11 is a version of standard C++ language. It was approved by International Organization for Standardization (ISO) on 12 August 2011 then C++14 and C++17. C++11 makes several additions to the core language. Visual C++ implements the vast majority of features in C++11. Some of the following C++11 features in ... Read More

How do malloc() and free() work in C/C++?

Chandu yadav
Published on 24-Oct-2018 12:50:26
malloc()The function malloc() is used to allocate the requested size of bytes and it returns a pointer to the first byte of allocated memory. It returns null pointer, if it fails.Here is the syntax of malloc() in C language, pointer_name = (cast-type*) malloc(size);Here, pointer_name  − Any name given to the ... Read More

What is the difference between new/delete and malloc/ free in C/ C++?

Arjun Thakur
Published on 24-Oct-2018 12:47:20
new/ deleteThe new operator requests for the memory allocation in heap. If the sufficient memory is available, it initializes the memory to the pointer variable and returns its address.The delete operator is used to deallocate the memory. User has the privilege to deallocate the created pointer variable by this delete ... Read More

What is the type of string literals in C/ C++?

Ankith Reddy
Published on 24-Oct-2018 12:42:38
The string literals are the set of characters which is enclosed in double quotes(“ “). Wide-string literals are prefixed with L always.Types of string literals −Sr.No.String Literals & Description1“ “Unprefixed string literal2L” “Wide-string literal3u8” “UTF-8 encoded string literal4u” “UTF-16 encoded string literal5U” “UTF-32 encoded string literal6R” “Raw string literalHere is ... Read More

Why are global variables bad in C/C++?

George John
Published on 24-Oct-2018 12:31:17
Global variables are declared and defined outside any function in the program. They hold their values throughout the lifetime of program. They are accessible throughout the execution of program.Non-const global variables are evil because their value can be changed by any function. Using global variables reduces the modularity and flexibility ... Read More

Atomics.sub() function in JavaScript

karthikeya Boyini
Published on 24-Oct-2018 11:15:34
The Atomic object of JavaScript is an object and which provides atomic operations such as add, sub, and, or, xor, load, store etc. as static methods, these methods are used with SharedArrayBuffer objects.The sub() function of the atomic object accepts a number and the position, subtracts the given number from ... Read More
Advertisements