Bhanu Priya has Published 1449 Articles

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

226 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

Decimal to Binary conversion using C Programming

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 06:05:08

3K+ Views

ProblemHow to convert a decimal number to a binary number by using the function in the C programming language?SolutionIn this program, we are calling a function to binary in main(). The called function to binary will perform actual conversion.The logic we are using is called function to convert decimal number ... Read More

What do you mean by function return in C language?

Bhanu Priya

Bhanu Priya

Updated on 08-Mar-2021 05:56:30

5K+ Views

A function is a self-contained block that carries out a specific task.The advantages of function in C language are as follows −ReusabilityThe length program can be reduced.It is easy to locate and isolate a wrong function.It facilitates top-down modular programming.ExampleFollowing is the C program for functions −#include /*Function prototypes*/ myfunc(); ... Read More

How to calculate sum of random numbers in between 0 to 100 using files in C Programming?

Bhanu Priya

Bhanu Priya

Updated on 06-Mar-2021 16:35:57

2K+ Views

In this program, we are adding random numbers that are generated in between 0 and 100.After every runtime, the result of sum of random numbers is different, i.e., we get a different result for every execution.The logic we use to calculate the sum of random numbers in between 0 to ... Read More

Write a C program using time.h library function

Bhanu Priya

Bhanu Priya

Updated on 06-Mar-2021 16:33:29

340 Views

ProblemHow to display the current date and time in ISO standard format using C Programming language?SolutionThe current date and time of the input will be taken and we are trying to print the system time and date in ISO format.For example, Monday, Dec 15, 2020 10.50p.The built-in functions that we ... Read More

Calculate interest amount by using formula in C language

Bhanu Priya

Bhanu Priya

Updated on 06-Mar-2021 16:17:24

884 Views

ProblemWrite a C program to calculate the deposited amount incremented after some years with interestSolutionThe formula for calculating interest is −M=((r/100) * t); A=P*exp(M);Where r= rate of interest            t=no. of years            P=amount to be deposited            ... Read More

Write a C program to demonstrate post increment and pre increment operators

Bhanu Priya

Bhanu Priya

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

3K+ Views

Increment operator (++)It is used to increment the value of a variable by 1. There are two types of increment operators, pre-increment and post-increment.The increment operator is placed before the operand in pre-increment and the value is first incremented and then the operation is performed on it.For example, z = ... Read More

Write C program using isupper() function

Bhanu Priya

Bhanu Priya

Updated on 06-Mar-2021 07:59:15

201 Views

ProblemHow to identify a total number of upper-case alphabets in a string using C Programming?SolutionThe logic we used to count number of upper-case letters in a sentence is as follows −for(a=string[0];a!='\0';i++){    a=string[i];    if (isupper(a)){       counter=counter+1;       //counter++;    } }Example 1 Live Demo#include #include ... Read More

Explain malloc function in C programming

Bhanu Priya

Bhanu Priya

Updated on 06-Mar-2021 07:56:53

671 Views

ProblemWrite a C program to display and add the elements using dynamic memory allocation functions.SolutionIn C, the library function malloc allocates a block of memory in bytes at runtime. It returns a void pointer, which points to the base address of allocated memory and it leaves the memory uninitialized.Syntaxvoid *malloc ... Read More

Advertisements