We can not copy an array using simple assignment operation like any other primitive data types. Here we’ll discuss the techniques to copy an array from one to another. By Traversing We can copy an array by traversing the source array – coping one element in each iteration. This is simplest, most common and widely … Continue reading “C Program to Copy an Array to Another”
Category: Programming
C Program to Check a Bit of an Integer
An integer consists of 32 bits. Here we’ll see how to write C program to check whether a particular bit is 0 or 1. The above diagram shows the binary representation of an integer 8,55,119. Bit position will start from 0. That means the least significant bit position is 0 and the most significant bit … Continue reading “C Program to Check a Bit of an Integer”
Change a Pointer from inside a C Function
We can change normal variable from inside a C function by passing the pointer of the variable. Here we’ll see how to change a pointer variable from inside a C function. Concept is same, here we have to pass the pointer of the pointer to the function. Code Snippet Here is the output. In main(), … Continue reading “Change a Pointer from inside a C Function”
Change a Variable from inside a C Function
Variables are meant to be changed. But changing a variable from inside a function is a tricky one in C-like programming. Let’s consider this code snippet. Here we started with a variable, x, of 5 and tried to change that from inside the function change_value() by adding 100 with it. The expectation is that the … Continue reading “Change a Variable from inside a C Function”
Function Overloading in C++
Function overloading in C++ allows us having multiple definitions of a single function or method. That means that we can have multiple functions with same name. But their input arguments need to be different, either in data type or number of arguments. In time of calling the function, the compiler decides which function to call … Continue reading “Function Overloading in C++”