We know that functions can be called by value and called by reference.If the actual parameter should not change in called function, pass the parameter-by value.If the value of actual parameter should get changed in called function, then use pass-by reference.If the function has to return more than one value, return these values indirectly by using call-by-reference. Read Also: Function Call by Value in C and Function Call by Reference in C ExampleFollowing is the C program for the demonstration of returning the multiple values − Live Demo#include void main() { void areaperi(int, int*, int*); int r; float ... Read More
Data structure is collection of data organized in a structured way. It is divided into two types as explained below − Linear data structure − Data is organized in a linear fashion. For example, arrays, structures, stacks, queues, linked lists. Nonlinear data structure − Data is organized in a hierarchical way. For example, Trees, graphs, sets, tables. Read Also: Data Structures and Types Queue Queue is a linear data structure, where the insertion is done at rear end ... Read More
Data structure is collection of data organized in a structured way. It is divided into two types as explained below −Linear data structure − Data is organized in a linear fashion. For example, arrays, structures, stacks, queues, linked lists.Nonlinear data structure − Data is organized in a hierarchical way. For example, Trees, graphs, sets, tables. Also Read: Data Structures and Types Queue Queue is a linear data structure, where the insertion is done at rear end and the deletion is done at the front end.The order of queue is FIFO – First In First OutOperationsInsert – Inserting an element into ... Read More
Problem Statement Given a binary number, you have to write a C program to find 2'c complements for given binary number. Consider an example given below −ExampleThe input is as follows:Enter a binary number:10010001The output is as follows:1's complement of 10010001 is 011011102's complement of 10010001 is 01101111AlgorithmRefer an algorithm to find 2’c complements for a given binary number.Step 1 − Start.Step 2 − Read the binary number at runtime.Step 3 − Copy the binary number to strdp.Step 4 − len: = strlen(str)Step 5 − For i = 0 to len-1 do Step 5.1 − if str[i] == ‘1’ ... Read More
In C programming language the reading and writing characters are as follows −The simplest of the console I/O functions are getche (), which reads a character from the keyboard, and putchar(), which prints a character to the screen.The getche () function works on until a key is pressed and then, returns its value. The key pressed is also echoed to the screen automatically.The putchar () function will write its character argument to the screen at the current cursor position.The declarations for getche () and putchar () are −int getche (void); int putchar (int c);The header file for getche () and ... Read More
The physical layer meets all these requirements out. The set of rules and procedures for interaction between physical layers are called Physical layer protocols. The layer provides a physical connection different from the physical transmission path because it is at the bit level while the transmission path is at the electrical signal level. This physical connection can be a point to point physical connection or point to the multi-point physical connection, as shown in the figure − The physical layer provides its services to the data link layer, the next higher layer of the OSI model. The ... Read More
In Java, Timestamp can be converted Date by using Date class. Date class is present in java.util package. The constructor of the Date class receives a long value as an argument. Since the constructor of the Date class requires a long value, we need to convert the Timestamp object into a long value using the getTime() method of the TimeStamp class. Let's deep dive into this article, to know how it can be done by using Java programming language. To show you with instance Suppose the timestamp is 06/01/2023. Then corresponding Date is “Fri Jan ... Read More
C programming language provides two types of searching techniques. They are as follows − Linear search Binary search Binary Search This method can be applied only to sorted list. The given list is divided into two equal parts. The given key is compared with the middle element of the list. Here, three situations may occur, which are as follows − If the middle element matches the key, then the search will end successfully here ... Read More
The library #include contains the basic memory operations. Although not strictly string functions, the functions are prototyped in #include . These memory operations are as follows − void *memchr (void *s, int c, size_t n); Search for a character in a buffer. int memcmp (void *s1, void *s2, size_t n); Compare two buffers. ... Read More
To locate a substring in a string, use the indexOf() method.Let’s say the following is our string.String str = "testdemo";Find a substring ‘demo’ in a string and get the index.int index = str.indexOf( 'demo');Example Live Demopublic class Demo { public static void main(String []args) { String str = "testdemo"; System.out.println("String: "+str); int index = str.indexOf("demo"); System.out.printf("Substring 'demo' is at index %d", index); } }OutputString: testdemo Substring 'demo' is at index 4
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP