Category: C++

What will happen if a print() statement is written inside a if() such as if(print())

Pre-requisite: if-elseThis article focuses on discussing what happens when the print statement is used inside the if-else conditional statement.For example: Consider the below code and predict the output.C  #include   int main(){        if (printf(“I’m Awesome!n”))                  main();          else if (printf(“I’m Not Awesomen”))                  main();}C++  #include using namespace std;  int main(){        if (printf(“I’m Awesome!n”))                  main();          else if (printf(“I’m Not Awesomen”))                  main();    return 0;}Guessing the Expected Output: Most general guess for the […]

Continue Reading

Top 50 C# Interview Questions & Answers

C# is a modern, object-oriented, and general-purpose programming language. It was developed by Microsoft with the .NET initiative. Here, we have covered the top 50 C# interview questions with their answers. These are frequently asked interview questions in C# interviews and designed for freshers. So let’s get started. 1. What is C#?C# is an object-oriented, modern […]

Continue Reading

std::tuple_element() and std::tuple_size() in C++ with Examples

std::tuple_element() and std::tuple_size() in C++ with ExamplesA tuple is an object that can hold a number of elements. The elements can be different data types. The elements of tuples are initialized as arguments in the order in which they will be accessed.The functions-tuple_element() and tuple_size()are only defined for elements using tuple_like interface.tuple_element():The C++ function tuple_element(array) […]

Continue Reading

Essential Maths for Competitive Programming Course By GeeksforGeeks

When we talk about Competitive Programming, we can’t ignore the significance of Mathematics here. Yes, it is true that one can get started with competitive programming without any mathematical background, but it is also an unbeatable fact that having good command over several specific mathematical concepts gives you the much-needed advantage over others while solving […]

Continue Reading

MSD( Most significant digit ) Radix Sort

#include #include using namespace std;struct node {    vector arr;    struct node* nxt[10];};struct node* new_node(void){    struct node* tempNode = new node;    for (int i = 0; i < 10; i++) {        tempNode->nxt[i] = NULL;    }        return tempNode;}void msd_sort(struct node* root, int exp,              vector& sorted_arr){    if (exp arr.size();         i++) {                j = (root->arr[i] / exp) % 10;                                if (root->nxt[j] == NULL) {            root->nxt[j] = new_node();        }                root->nxt[j]->arr.push_back(            root->arr[i]);    }            for (int i = 0; i […]

Continue Reading

7 Best Unity Books For Game Development

You must have heard of the fact that not all fingers are the same, but each of the ones is useful when the different condition is met. Similarly, in real life, not all human beings have the same qualities, some may be good in athletics, academics and some may be in drama, etc. Meanwhile, coming […]

Continue Reading

push_back() vs emplace_back() in C++ STL Vectors

push_back() vs emplace_back() in C++ STL VectorsIn C++, vectors are dynamic arrays, that can grow or shrink and their storage is handled by the container itself. There are two ways of inserting an element in a vector. They are push_back() and emplace_back(). In this article, we will discuss the difference between them.push_back():This method is used […]

Continue Reading