Evaluate Expressions of Stacks in C Language

Bhanu Priya
Updated on 06-Dec-2024 15:49:44

21K+ Views

Stack is a linear data structure, that allows elements to be added and removed in a last-in, first-out(LIFO). The main operations are − Push Pop Display The Push Operation A stack adds a new item on top. A stack overflow occurs when the stack is full and cannot specify more items. Given below is an algorithm for Push() − Check for stack overflow. if (top = = n-1) printf("stack over flow"); Otherwise, insert an element into the stack. top ++ a[top] = item The ... Read More

Differentiate Null Pointer and Void Pointer in C Language

Sindhura Repala
Updated on 06-Dec-2024 15:41:23

12K+ Views

The difference between a Null pointer and a Void pointer is that a Null pointer represents a value, while a Void pointer is a type identifier. NULL Pointer A null pointer indicates that it does not point to anything. If a pointer has no assigned address, it should be set to null. Each pointer type, such as int* or char*, can have a null pointer value. The syntax is as follows − * = NULL; Example Following is the C program for NULL pointer − #include int main() { printf("TutorialPoint C ... Read More

Explain the Concepts of Pointers and Arrays in C Language

Bhanu Priya
Updated on 06-Dec-2024 15:26:29

3K+ Views

Pointers and Arrays A pointer in C is a variable that stores the address of another variable, which can be of any type(char, int, function). In a 32-bit system, the size of the pointer is 2 bytes. An array is a collection of similar data items stored in contiguous memory locations. In C, arrays can store various data types(char, int, double float) as well as specific types(pointer structures). For example, if we need to represent an array of 5 elements we need to create it as - int a [5] = {10, 20, 30, 40, 50}; ... Read More

Explain putc and getc Functions of Files in C Language

Bhanu Priya
Updated on 06-Dec-2024 14:45:51

12K+ Views

A file is a collection of data stored in secondary memory. Files are used to store information that programs can determine. A file represents a sequence of bytes, whether it is a text file or a binary file. It is a collection of records or a location on the hard disk where data is stored permanently. Operations on Files The operations on files in the C programming language are as follows − Naming the file Opening the file Reading from the file Writing into ... Read More

C# Program to Count Prime Numbers in an Array

AYUSH MISHRA
Updated on 06-Dec-2024 11:34:03

13K+ Views

Prime numbers are natural numbers greater than 1 with only two factors: 1 and themselves. Examples include 2, 3, 5, 7, etc. The smallest prime number is 2. Problem Description We are given an array and need to find the number of prime numbers in the array using C#. Below is an example to understand the problem: Examples Input: array = { 3, 6, 12, 7, 9, 11} Output: array = {3, 7, 11} Explanation: The numbers 3, 7, and 11 have only two factors: 1 and themselves, so they are prime numbers. Input: array = {4, ... Read More

Create Multiple Themes Using Tailwind CSS

Disha Verma
Updated on 06-Dec-2024 10:20:47

122 Views

Many modern web apps require different themes, like light and dark modes, to enhance a user's experience. However, setting up and changing themes with Tailwind CSS can be confusing for developers. This article offers easy and effective methods to create and manage multiple themes with Tailwind CSS. Approaches to Create Multiple Themes Extending Tailwind Configuration for Themes Using CSS Variables Extending Tailwind Configuration for Themes You can make different themes in Tailwind CSS by changing the Tailwind configuration file (tailwind.config.js). This lets you set up your own ... Read More

Difference Between React Native and React

Samir Bhimbha
Updated on 06-Dec-2024 10:16:07

196 Views

React is a well-known JavaScript library mostly used to build dynamic and interactive user interface applications for the web. It is a creation of Facebook, which lets developers create reusable UI components and also provides a virtual DOM on which rendering is to be done. React Native is a new concept that applies the logic of React to developing mobile applications. That means developers can write mobile apps for both iOS and Android operating systems. Using React Native, one would get identical compiling with a single codebase. Using native components instead of elements from the web gives a real ... Read More

Find Maximum Occurrence of Character in a String in C

Bhanu Priya
Updated on 06-Dec-2024 02:01:55

4K+ Views

An array of characters is called a string. Declaration Following is the declaration declaring an array is as follows − char stringname [size]; For example: char string[50]; string of length 50 characters Initialization Using single character constant − char string[10] = { ‘H’, ‘e’, ‘l’, ‘l’, ‘o’ ,‘\0’} Using string constants − char string[10] = "Hello":; Accessing − There is a control string "%s" used for accessing the string till it encounters ‘\0’. Finding maximum occurrence The logic to find the maximum occurrence of character is − ... Read More

Find Maximum Element of Each Row in a Matrix using JavaScript

AmitDiwan
Updated on 06-Dec-2024 01:42:02

506 Views

In JavaScript, the 2D matrix manipulation involves working with arrays of arrays, often to perform operations on rows or columns. In this example, we focus on finding the maximum value in each row of a matrix. Two methods are demonstrated: using nested loops for step-by-step iteration, and using map() with Math.max() for a more concise, functional approach. Both methods return an array of the maximum values from each row, but the map() approach is more efficient and modern. Different approaches Following are the different approaches to finding maximum element of each row in a matrix − ... Read More

Reduce Sum of Array with Undefined Values in JavaScript

AmitDiwan
Updated on 06-Dec-2024 01:41:22

896 Views

If you’re working with arrays in JavaScript, you may encounter situations where your array contains undefined values. This can happen when you're processing data from various sources or working with incomplete datasets. One common problem developers face is summing the values of an array with undefined elements. JavaScript’s reduce() method is a versatile tool that can help you solve this problem efficiently. In this article, we will explore how to use the reduce() method to sum an array, even when it includes undefined values, and ensure that the final result is correct. What is the reduce() Method in JavaScript? The ... Read More

Advertisements