Bhanu Priya

Bhanu Priya

1,061 Articles Published

Articles by Bhanu Priya

Page 57 of 107

Explain Compile time and Run time initialization in C programming?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 20K+ Views

In C programming, array initialization can occur at two different times: compile time and run time. Understanding the difference between these two approaches is crucial for effective memory management and program design. Syntax // Compile time initialization type array_name[size] = {value1, value2, ..., valueN}; // Run time initialization type array_name[size]; // Values assigned during program execution Compile Time Initialization In compile time initialization, array values are specified directly in the source code when the array is declared. The compiler allocates memory and assigns values during the compilation process − #include ...

Read More

Why is the compiler not reading string after integer in C programming?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 2K+ Views

When reading string input after integer input in C, a common issue occurs where the string appears to be skipped. This happens because scanf() leaves a newline character in the input buffer after reading the integer. The Problem When you use scanf() to read an integer and then try to read a string using gets() or fgets(), the leftover newline character from the integer input is immediately consumed by the string function, causing it to terminate without reading actual string input. Solution Methods Method 1: Using a Temporary Character Read the leftover newline character using ...

Read More

What is the common error occurred while using scanf() statement in C language?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 1K+ Views

The scanf() function in C is commonly used to read formatted input, but it often causes issues when reading strings after numeric values. The main problem occurs because scanf() leaves a newline character in the input buffer after reading numbers, which interferes with subsequent string input functions. Common Error When using scanf() to read numeric data followed by string input with gets() or fgets(), the string input is skipped because the leftover newline character from the previous scanf() is immediately consumed. Example: Demonstrating the Problem Here's a program that shows the common error when reading a ...

Read More

How to print a name multiple times without loop statement using C language?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 8K+ Views

In C programming, printing a name multiple times typically requires loops. However, we can achieve this without using any loop or goto statement by implementing recursive functions or using multiple printf statements. Syntax void recursiveFunction(parameters) { // Base case if (condition) return; // Process printf("text"); // Recursive call recursiveFunction(modified_parameters); } Method 1: Using ...

Read More

Find the ASCII value of the uppercase character 'A' using implicit conversion in C language?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 602 Views

Implicit type conversion occurs when the compiler automatically converts a smaller data type to a larger data type without explicit casting. In C, when a char is used in an arithmetic operation, it gets implicitly converted to an int, allowing us to access its ASCII value. Syntax int ascii_value = character + 0; // Implicit conversion from char to int Example 1: ASCII Value of 'A' The following example demonstrates finding the ASCII value of uppercase character 'A' using implicit conversion − #include int main() { ...

Read More

What are the 4 steps to convert C program to Machine code?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 5K+ Views

Converting a C program to machine code is a multi-stage process that transforms human-readable source code into executable machine instructions. This process involves four essential steps that work together to create a runnable program. The 4 Steps to Convert C Program to Machine Code The conversion process follows these four sequential steps − Writing and Editing − Creating the source code Preprocessing − Processing directives and preparing code Compiling − Translating to machine language Linking − Creating the final executable Source Code (.c) ...

Read More

C program for DFA accepting all strings over w ∈(a,b)* containing "aba" as a substring

Bhanu Priya
Bhanu Priya
Updated on 11-Mar-2026 3K+ Views

ProblemDesign a DFA for the language L={w1abaw2 | w1, w2 Є(a, b)*}, which means the DFA accepts all strings which contain “aba” as a substring.SolutionThe strings that are accepted by language L= {aba, aabaa, aabab, babab, ababa, …….}Step 1 − Transition diagram for minimal string (starting string) −If w1 and w2 are null then the string it generates is “aba” because w1, w2 ε(a, b)*q0 is the initial state and q3 is the final state.Step 2 − The final DFA for the given language is as follows −Explanationqo is the initial state q0 on ‘a’ goes to q1 and on ...

Read More

C Program to construct DFA accepting odd numbers of 0s and 1s

Bhanu Priya
Bhanu Priya
Updated on 11-Mar-2026 10K+ Views

Construct deterministic finite automata (DFA) for the language L = { w : w has odd number of 0’s and w has odd number of 1’s}, over the alphabet Σ = {0, 1}.Example0111, 010101, 01110011 is an accepted string, because those strings have an odd number of 0’s and an odd number of 1’s.For the given language we will need four states to draw the main DFA which will read odd no. of 0s and 1s. We can also draw it by merging the two DFAs in which one will accept only an odd number of 0s and one accepts ...

Read More

C Program to build DFA accepting the languages ending with "01

Bhanu Priya
Bhanu Priya
Updated on 11-Mar-2026 18K+ Views

ProblemDesign deterministic finite automata (DFA) with ∑ = {0, 1} that accepts the languages ending with “01” over the characters {0, 1}.SolutionThe strings that are generated for a given language are as follows −L={01, 001, 101, 110001, 1001, ……….}The minimum length of the string is 2, the number of states that the DFA consists of for the given language is: 2+1 = 3 states.Here, q0 − On input 0 it goes to state q1 and on input 1 it goes to itself.q1 − On input 0 it goes to itself and on input 1 it goes to State q2.q2 − ...

Read More

What is shared memory architecture in parallel databases?

Bhanu Priya
Bhanu Priya
Updated on 04-Jul-2024 5K+ Views

In parallel database system data processing performance is improved by using multiple resources in parallel. In this CPU, disks are used parallel to enhance the processing performance. Operations like data loading and query processing are performed parallel. Centralized and client server database systems are not powerful enough to handle applications that need fast processing. Parallel database systems have great advantages for online transaction processing and decision support applications. Parallel processing divides a large task into multiple tasks and each task is performed concurrently on several nodes. This gives a larger task to complete more quickly. Architectural Models There are several ...

Read More
Showing 561–570 of 1,061 articles
« Prev 1 55 56 57 58 59 107 Next »
Advertisements