Samual Sam has Published 2664 Articles

Pointer to an Array in C

Samual Sam

Samual Sam

Updated on 14-Sep-2023 21:15:58

25K+ Views

Pointers are variables which stores the address of another variable. When we allocate memory to a variable, pointer points to the address of the variable. Unary operator (*) is used to declare a variable and it returns the address of the allocated memory. Pointers to an array points the address ... Read More

Array Copy in Java

Samual Sam

Samual Sam

Updated on 13-Sep-2023 15:09:03

26K+ Views

Array in Java can be copied to another array using the following ways.Using variable assignment. This method has side effects as changes to the element of an array reflects on both the places. To prevent this side effect following are the better ways to copy the array elements.Create a new ... Read More

Check if a Java ArrayList contains a given item or not

Samual Sam

Samual Sam

Updated on 13-Sep-2023 13:01:11

30K+ Views

The java.util.ArrayList.contains() method can be used to check if a Java ArrayList contains a given item or not. This method has a single parameter i.e. the item whose presence in the ArrayList is tested. Also it returns true if the item is present in the ArrayList and false if the ... Read More

How to find the index of an item in a C# list in a single step?

Samual Sam

Samual Sam

Updated on 09-Sep-2023 23:28:21

32K+ Views

To get the index of an item in a single line, use the FindIndex() and Contains() methods.int index = myList.FindIndex(a => a.Contains("Tennis"));Above, we got the index of an element using the FindIndex(), which is assisted by Contains() method for that specific element.Here is the complete code −Example Live Demousing System; using ... Read More

C++ Program to Find Fibonacci Numbers using Recursion

Samual Sam

Samual Sam

Updated on 06-Sep-2023 21:11:54

46K+ Views

The following is an example of fibonacci series using recursion.Example Live Demo#include using namespace std; int fib(int x) {    if((x==1)||(x==0)) {       return(x);    }else {       return(fib(x-1)+fib(x-2));    } } int main() {    int x , i=0;    cout x;    cout

Framing in Data Link Layer

Samual Sam

Samual Sam

Updated on 06-Sep-2023 20:59:49

43K+ Views

In the physical layer, data transmission involves synchronised transmission of bits from the source to the destination. The data link layer packs these bits into frames. Data-link layer takes the packets from the Network Layer and encapsulates them into frames. If the frame size becomes too large, then the packet ... Read More

How to convert string to array of integers in java?

Samual Sam

Samual Sam

Updated on 06-Sep-2023 12:59:19

38K+ Views

You can convert a String to integer using the parseInt() method of the Integer class. To convert a string array to an integer array, convert each element of it to integer and populate the integer array with them.Example Live Demoimport java.util.Arrays; public class StringToIntegerArray { public static void ... Read More

Java program to find the 2nd largest number in an array

Samual Sam

Samual Sam

Updated on 02-Sep-2023 15:09:09

49K+ Views

To find the second largest element of the given array, first of all, sort the array.Sorting an arrayCompare the first two elements of the arrayIf the first element is greater than the second swap them.Then, compare 2nd and 3rd elements if the second element is greater than the 3rd swap ... Read More

How to Create a Multi-line Text Input (Text Area) In HTML?

Samual Sam

Samual Sam

Updated on 02-Sep-2023 13:59:12

43K+ Views

To create a multi-line text input, use the HTML tag. You can set the size of a text area using the cols and rows attributes. It is used within a form, to allow users to input text over multiple rows.Here are the attributes of tag −AttributeValueDescriptionautofocusautofocusSpecifies that on ... Read More

How to pass Arrays to Methods in Java?

Samual Sam

Samual Sam

Updated on 02-Sep-2023 13:52:53

51K+ Views

You can pass arrays to a method just like normal variables. When we pass an array to a method as an argument, actually the address of the array in the memory is passed (reference). Therefore, any changes to this array in the method will affect the array.Suppose we have two ... Read More

Advertisements