Anvi Jain has Published 629 Articles

Function Pointer in C

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

4K+ Views

Function Pointers point to code like normal pointers.In Functions Pointers, function’s name can be used to get function’s address.A function can also be passed as an arguments and can be returned from a function.Declarationfunction_return_type(*Pointer_name)(function argument list)Example Live Demo#include int subtraction (int a, int b) {    return a-b; } int main() ... Read More

How can I intercept the Status Bar Notifications in Android?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

714 Views

This example demonstrate about How can I intercept the Status Bar Notifications in AndroidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to src/MyListener.javapublic interface MyListener { ... Read More

MongoDB Query to search for records only in a specific hour?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

448 Views

For this, use the $hour operator. Let us first create a collection with documents with one of the field as date −> db.mongoDbSearchForHoursDemo.insertOne({"CustomerName":"Larry", "OrderDatetime":new ISODate("2019-01-31 09:45:50")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6e8a86d78f205348bc62a") } > db.mongoDbSearchForHoursDemo.insertOne({"CustomerName":"Larry", "OrderDatetime":new ISODate("2019-02-21 01:10:01")}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6e8b86d78f205348bc62b") ... Read More

C++ Program to Implement Affine Cipher

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

2K+ Views

In the Affine cipher, each letter in an alphabet is mapped to its numeric equivalent, is a type of monoalphabetic substitution cipher. Encryption is done using a simple mathematical function and converted back to a letter.The letters of an alphabet of size m are first mapped to the integers in ... Read More

How to set the alignment of the JLabel content along the Y axis in the bottom with Java

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

362 Views

Set the alignment of the label’s content along the Y axis on the bottom, use the setVerticalAlignment() method and set the location. Let us first set a label component. We have set the label background color as well so that we can check the alignment of the label’s content properly ... Read More

How to declaring pointer variables in C/C++?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

414 Views

A pointer is used to store the address of the variables. To declare pointer variables in C/C++, an asterisk (*) used before its name.Declaration*pointer_nameIn CExample Live Demo#include int main() {    // A normal integer variable    int a = 7;    // A pointer variable that holds address of ... Read More

C++ Program to Find the Shortest Supersequence that Contains Two or more Sequences as Subsequences

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

111 Views

Here we shall discuss a C++ Program to find the Shortest Supersequence that contains two or more Sequences as Subsequences.AlgorithmBegin    function ShortestSubSeq() returns supersequence of A and B:    1) Declare an array ss[i][j] which contains length of shortest supersequence for A[0 .. i-1] and B[0 .. j-1].   ... Read More

C++ Program to Find the Longest Prefix Matching of a Given Sequence

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

444 Views

Here we shall discuss a C++ program to find the Longest Subsequence Common to All Sequences in a Set of Sequences.AlgorithmsBegin Take the array of strings as input. function matchedPrefixtill(): find the matched prefix between string s1 and s2 :    n1 = store length of string s1.    n2 ... Read More

Functions that can’t be overloaded in C++

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

271 Views

In C++, we can overload the functions. But sometimes the overloading is not done. In this section, we will see what are the different cases, in which we cannot overload the functions.When function signatures are same, only the return type is different, then we cannot overload the function.int my_func() { ... Read More

RAII and smart pointers in C++

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

1K+ Views

RAII in C++RAII (Resource Acquisition Is Initialization) is C++ technique which control the life cycle of resource. It is a class variant and is tied to object life time.It encapsulates several resources into class where resource allocation is done by constructor during object creation and resource deallocation is done by ... Read More

Advertisements