Bhanu Priya has Published 1447 Articles

Accessing variables of Int and Float without initializing in C

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 06:48:26

2K+ Views

ProblemDeclare int and float variables without initializing and try to print their values in C language. Explain what will happen.SolutionIf a variable is declared but not initialized or uninitialized and if those variables are trying to print, then, it will return 0 or some garbage value.Whenever we declare a variable, ... Read More

Given an example of C pointer addition and subtraction

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 06:45:44

3K+ Views

Pointers have many but easy concepts and they are very important to C programming.Two of the arithmetic pointer concepts are explained below, which are C pointer addition and subtraction respectively.C pointer additionC pointer addition refers to adding a value to the pointer variable.The formula is as follows −new_address= current_address + ... Read More

Demonstrate the concept of pointers using C language

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 06:43:58

643 Views

The pointer is a variable that stores the address of another variable.The syntax for the pointer is as follows −pointer = &variable;ExampleFollowing is the C program for the concept of pointers using C language − Live Demo#include void main(){    //Declaring variables and pointer//    int a=2;    int *p;   ... Read More

Explain the concept of pointer to pointer and void pointer in C language?

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 06:40:29

1K+ Views

Double pointer or pointer to pointer is a variable that holds the address of another pointer.Following is the declaration for a pointer to a pointer −datatype ** pointer_name;For example, int **p; p is a pointer to pointerInitialization − ‘&’ is used for initialization.For example, int a = 10; int *p; ... Read More

Compute sum of all elements in 2 D array in C

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 06:19:59

4K+ Views

ProblemCalculate the sum of all elements of a two-dimensional array by using run-time initialization.SolutionTwo-dimensional Array is used in situations where a table of values have to be stored (or) in matrices applicationsThe syntax is as follows −datatype array_ name [rowsize] [column size];For example, int a[4] [4];Number of elements in an ... Read More

C Program on two-dimensional array initialized at run time

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 06:18:38

412 Views

ProblemCalculate the sum and product of all elements in an array by using the run-time compilation.SolutionA two-dimensional array is used in situations where a table of values have to be stored (or) in matrices applicationsThe syntax is as follows −datatype array_ name [rowsize] [column size];For example, int a[5] [5];Number of ... Read More

How to print the elements in a reverse order from an array in C?

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 06:16:34

9K+ Views

Try to print the elements in reverse order by following an algorithm given below −Step1 − Declare an array of size 5Step 2 − Enter the 5 elements in memory using for loopStep 3 − Display elements in reverse orderBy decrementing for loopThe only logic is to reverse the elements ... Read More

What are the Pre-processor Commands in C language?

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 06:14:36

4K+ Views

The preprocessor is a program that sends the source code before it passes through the compiler. It operates under preprocessor directives which begin with the symbol #.TypesThe three types of preprocessor commands are as follows −Macro substitution directives.File inclusion directives.Compiler control directives.Macro substitution directivesIt replaces every occurrence of an identifier ... Read More

Explain volatile and restrict type qualifiers in C with an example

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 06:13:02

1K+ Views

Type qualifiers add special attributes to existing data types in C programming language.There are three type qualifiers in C language and volatile and restrict type qualifiers are explained below −VolatileA volatile type qualifier is used to tell the compiler that a variable is shared. That is, a variable may be ... Read More

Explain the constant type qualifier in C language

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 06:10:16

256 Views

Type qualifiers add special attributes to existing datatypes in C programming language.There are three type qualifiers in C language and constant type qualifier is explained below −ConstThere are three types of constants, which are as follows −Literal constantsDefined constantsMemory constantsLiteral constants − These are the unnamed constants that are used ... Read More

Advertisements