- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
In C language, there are three methods to convert a char type variable to an int. These are given as follows −sscanf()atoi()TypecastingHere is an example of converting char to int in C language, Example Live Demo#include #include int main() { const char *str = "12345"; char c = 's'; int x, y, z; sscanf(str, "%d", &x); // Using sscanf printf("The value of x : %d", x); y = atoi(str); // Using atoi() printf("The value of y : %d", y); z = (int)(c); // Using typecasting printf("The value of z ... Read More
In this tutorial, we are going to learn how to create a linked list from the given array.Let's see the steps to solve the problem.Initialize the array with dummy data.Write the struct node.Iterate over the array.Create a new node with the data.Insert the new node into the linked list.Print the linked list.ExampleLet's see the code.#include using namespace std; struct Node { int data; Node* next; }; struct Node* newNode(int data) { Node* node = new Node; node->data = data; node->next = NULL; return node; } void insertNewNode(Node** root, int data) { Node* ... Read More
In this example, we will create a rounded button in a window that can be used in many other applications like forms, games, dialogue boxes, etc.The best way to create rounded buttons in Tkinter is to use the desired images of buttons and turn it into a clickable button in the frame. That is really possible by using PhotoImage() function which grabs the desired image of the button.So, the following steps make the desired image a button, First, we will create a dummy button which can be used to make the image clickable.Grab the image from the source using PhotoImage(file) ... Read More
A struct is simply a collection of different types of variable. Structs in Arduino mimic the structs in C language. So, if you are familiar with C structs, Arduino structs shouldn’t be an issue. The struct declaration syntax is as follows −Syntaxstruct structName{ item1_type item1_name; item2_type item2_name; . . . itemN_type itemN_name; }An example is given below −Examplestruct student{ String name; int age; int roll_no; }The elements of a struct are accessed using the . (dot) notation. This notation can be used for both reading the elements of a struct, or changing ... Read More
Both Procedural Programming and Object Oriented Programming are high-level languages in programming world and are widely used in the development of applications. On the basis of nature of developing the code, both languages have different approaches on basis of which both are differentiate from each other. In this article, we will discuss the important differences between procedural oriented programming and object oriented programming. But before going into the differences, let's start with some basics. What is Procedural Programming? Procedural Programming is a programming language that follows a step-by-step approach to break down a task into a collection of variables ... Read More
For ENTER key press event, you can call a function on −onkeypress=”yourFunctionName”Use the ENTER’s keycode 13.Example Live Demo Document function enterKeyPressed(event) { if (event.keyCode == 13) { console.log("Enter key is pressed"); return true; } else { return false; } } To run the above program, save the file name "anyName.html (index.html)" and right click on the file. Select the option "Open with Live Server" in VS Code editor.OutputThis will produce the following output −On pressing ENTER key, the following output is visible on console −
In JavaScript, there are different ways to convert an array of strings to an array of numbers. The first way is to use the built-in parseInt() method, and the second way is to use a type conversion function, and the third one is to use the unary + operator.Using the parseInt() methodThe parseInt() method is a built-in function in JavaScript that takes a string as an argument and returns a number. This method can be used to convert an array of strings to an array of numbers.SyntaxThe syntax of the parseInt() method is as follows −parseInt(string, radix);ParametersString − The string ... Read More
Whenever we want to stop a thread from running state by calling stop() method of Thread class in Java. This method stops the execution of a running thread and removes it from the waiting threads pool and garbage collected. A thread will also move to the dead state automatically when it reaches the end of its method. The stop() method is deprecated in Java due to thread-safety issues.Syntax@Deprecated public final void stop()Exampleimport static java.lang.Thread.currentThread; public class ThreadStopTest { public static void main(String args[]) throws InterruptedException { UserThread userThread = new UserThread(); Thread thread = new Thread(userThread, ... Read More
We can use xpath to grab SVG elements with Selenium Webdriver. A SVG element is identified with tagname svg. The svg image has the attributes like width and height attributes.Let us investigate the html code of a svg element.To create a xpath for a svg element, we have the syntax as //*[local-name()='svg'].The local-name function is mandatory for creating a xpath of a svg element. So for the xpath expression for the image highlighted in the above image should be −//*[local-name()='svg' and @data-icon='home']/*[local-name()='path']Here, data-icon is an attribute of the svg tag element which is added accompanied with @ symbol. The [local-name()='path'] is ... Read More
HashMap and HashSet both are one of the most important classes of Java Collection framework.Following are the important differences between HashMap and HashSet.Sr. No.KeyHashMapHashSet1ImplementationHashmap is the implementation of Map interface.Hashset on other hand is the implementation of set interface.2Internal implementationHashmap internally do not implements hashset or any set for its implementation.Hashset internally uses Hashmap for its implementation.3Storage of elementsHashMap Stores elements in form of key-value pair i.e each element has its corresponding key which is required for its retrieval during iteration.HashSet stores only objects no such key value pairs maintained.4Method to add elementPut method of hash map is used to ... Read More