Bhanu Priya has Published 1660 Articles

What is a multidimensional array in C language?

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:21:15

226 Views

C language allows arrays of three (or) more dimensions. This is a multidimensional array.The exact limit is determined by the compiler.The syntax is as follows −datatype arrayname [size1] [size2] ----- [sizen];For example, for three – dimensional array −int a[3] [3] [3];Number of elements = 3*3*3 = 27 elementsExampleFollowing is the ... Read More

How to count number of vowels and consonants in a string in C Language?

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:19:18

1K+ Views

ProblemHow to write a C program to count numbers of vowels and consonants in a given string?SolutionThe logic that we will write to implement the code to find vowels and consonants is −if(str[i] == 'A' || str[i] == 'E' || str[i] == 'I' || str[i] == 'O' || str[i] == ... Read More

Structure declaration in C language

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:15:03

12K+ Views

The structure is a collection of different datatype variables, grouped together under a single name. It is a heterogeneous collection of data items that share a common name.Features of structureIt is possible to copy the contents of all structural elements of different data types to another structure variable of its ... Read More

What is call by value in C language?

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:12:37

484 Views

Pass by value or call by value are sent as arguments.AlgorithmRefer to the algorithm for the call by value.Step 1: Enter any 2 numbers at runtime Step 2: Read those two numbers from console Step 3: Call the function swap with arguments is a call by value Step 4: Go ... Read More

What is call by reference in C language?

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:10:58

512 Views

Pass by reference means addresses are sent as arguments.The call by reference or pass by reference method passes the arguments to a function by the means of address to an argument. This is done into the formal parameter. Inside the function, the address is used to access an actual argument.Example#include ... Read More

How to find a leap year using C language?

Bhanu Priya

Bhanu Priya

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

264 Views

Leap year is a year that consists of 366 days. For every four years, we will experience a leap year.The logic we will implement to find whether the given year by the user through the console is a leap or not −if (( year%400 == 0)|| (( year%4 == 0 ... Read More

How to display the complete text one word per line in C language?

Bhanu Priya

Bhanu Priya

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

928 Views

First, open the file in write mode. Later on, enter the text until it reaches the End Of File (EOF) i.e. press ctrlZ to close the file.Again, open in reading mode. Then, read words from the file and print each word in a separate line and close the file.The logic ... Read More

Explain the accessing of structure variable in C language

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:05:00

938 Views

The structure is a user-defined data type, which is used to store a collection of different data types of data.The structure is similar to an array. The only difference is that an array is used to store the same data types whereas, the structure is used to store different data ... Read More

How to access an array element in C language?

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 10:02:11

5K+ Views

An array is a group of related data items that share a common name. A particular value in an array is identified by using its "index number" or "subscript".The advantage of an array is as follows −The ability to use a single name to represent a collection of items and ... Read More

How to write a simple calculator program using C language?

Bhanu Priya

Bhanu Priya

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

17K+ Views

Begin by writing the C code to create a simple calculator. Then, follow the algorithm given below to write a C program.AlgorithmStep 1: Declare variables Step 2: Enter any operator at runtime Step 3: Enter any two integer values at runtime Step 4: Apply switch case to select the operator: ... Read More

Advertisements