Bhanu Priya has Published 1660 Articles

Matrix row sum and column sum using C program

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 08:21:57

3K+ Views

ProblemLet’s write a C program to compute the row sum and column sum of a 5 x 5 array using run time compilation.SolutionIn this program, we are entering the values of array which is of size 5X5 matrix during runtime in the console, with the help of for loops we ... Read More

Explain the concept of Array of Pointer and Pointer to Pointer in C programming

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 08:20:19

1K+ Views

Array Of PointersJust like any other data type, we can also declare a pointer array.Declarationdatatype *pointername [size];For example, int *p[5]; //It represents an array of pointers that can hold 5 integer element addressesInitializationThe ‘&’ is used for initializationFor example,int a[3] = {10,20,30}; int *p[3], i; for (i=0; i

Explain the concepts of Pointers and arrays in C language

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 08:17:06

3K+ Views

Pointers and arraysContinuous memory locations are allocated for all the elements of the array by the compiler.The base address is the location of the first element in the array.For example, int a [5] = {10, 20, 30, 40, 50};The five elements are stored as follows −If ‘p’ is declared as ... Read More

Explain Arithmetic operations using pointers in C language?

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 08:15:19

953 Views

Pointer is a variable which stores the address of other variable.Pointer declaration, initialization and accessingConsider the following statement −int qty = 179;Declaring a pointerint *p;‘p’ is a pointer variable that holds the address of another integer variable.Initialization of a pointerAddress operator (&) is used to initialize a pointer variable.int qty ... Read More

Different storage classes in C Language

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 08:14:00

254 Views

ProblemWhat are different storage classes in C Language? Explain them with programs?SolutionA storage class is defined as the scope and life-time of variables or a functions that is present within a C Program.Storage classesFollowing are the storage classes in C −autoexternstaticregisterAutomatic variables/Local variablesKeyword − autoThese are also called local variablesScope ... Read More

How to pass individual elements in an array as argument to function in C language?

Bhanu Priya

Bhanu Priya

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

1K+ Views

If individual elements are to be passed as arguments, then array elements along with their subscripts must be given in function call.To receive the elements, simple variables are used in function definition.Example 1#include main (){    void display (int, int);    int a[5], i;    clrscr();    printf (“enter 5 ... Read More

How to pass entire array as an argument to a function in C language?

Bhanu Priya

Bhanu Priya

Updated on 09-Mar-2021 08:08:41

849 Views

ArrayThe array is a group of related items that store with a common name. Following are the two ways of passing arrays as arguments to functions −sending entire array as argument to functionsending individual elements as argument to functionSending entire array as an argument to a functionTo send entire array ... Read More

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

Bhanu Priya

Bhanu Priya

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

459 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

372 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

237 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

Advertisements