Bhanu Priya has Published 1581 Articles

How to print the numbers in different formats using C program?

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 08:07:30

485 Views

ProblemWhat is the logic in C language to print the numbers in different formats like pyramid, right angle triangle?SolutionTo print the numbers or symbols in different model we can take the help of for loop in the code.Example1Following is the C program to print pyramid − Live Demo#include int main(){   ... Read More

What are the scope rules to functions in C programming?

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 08:03:16

381 Views

Local scopeLocal scope specifies that variables defined within the block are visible only in that block and invisible outside the block.Global scopeGlobal scope specifies that variables defined outside the block are visible up to end of the program.Example#include int r= 50; /* global area */ main (){    int p ... Read More

What are the local and global scope rules in C language?

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 07:27:45

248 Views

Global scopeGlobal scope specifies that variables defined outside the block are visible up to end of the program.Example#include int c= 30; /* global area */ main (){    int a = 10;    printf (“a=%d, c=%d” a, c);    fun (); } fun (){    printf (“c=%d”, c); }Outputa =10, ... Read More

Explain Compile time and Run time initialization in C programming?

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 07:18:46

15K+ Views

Let’s take the concept of arrays to about compile time and run time initialization −ArrayArray is a collection of items stored at contiguous memory locations and elements can access by using indices.Compile time array initializationIn compile time initialization, user has to enter the details in the program itself.Compile time initialization ... Read More

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

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 07:17:09

2K+ Views

ProblemCompiler not reading the string after integer in C programming? How can we solve this problem?SolutionWhen you enter an integer number and press enter to read next value, compiler stores null into the string’s first char and string input terminates. Because scanf will terminate whenever it reads a null character.How ... Read More

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

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 07:14:33

805 Views

ProblemCommon error occurred while reading string and numeric data using scanf() function in C languageSolutionThe scanf() function is used to read formatted input from stdin in C language. It returns the whole number of characters written in it otherwise, returns a negative value.Generally in case of scanf() function while reading ... Read More

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

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 07:13:35

6K+ Views

ProblemTry to print a name 10 times without using any loop or goto statement in C programming language.SolutionGenerally, looping statements are used to repeat the block of code until condition is false.Example1In this program, we are trying to print a name 10 times without using loop or goto statements. Live Demo#include ... Read More

Is it possible to give arguments in the main() function in C language?

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 07:10:36

4K+ Views

Yes, we can give arguments in the main() function.Command line arguments in C are specified after the name of the program in the system’s command line, and these argument values are passed on to your program during program execution.The argc and argv are the two arguments that can pass to ... Read More

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

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 07:09:37

350 Views

Implicit type conversion is done by the compiler by converting smaller data type into a larger data type.For example, ASCII value of A=65.In this program, we are giving character ‘A’ as input, now write a code to convert A to 65 which is its ASCII value.ExampleFollowing is the example to ... Read More

What are the different types of functions in C Programming?

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 07:06:23

13K+ Views

Functions are broadly classified into two types which are as follows −predefined functionsuser defined functionsPredefined (or) library functionsThese functions are already defined in the system libraries.Programmer can reuse the existing code in the system libraries which is helpful to write error free code.User must be aware of syntax of the ... Read More

Advertisements