Wednesday - June 7, 2023

Explain a Type Qualifiers

type qualifiers

Type Qualifiers

Q) List four type qualifiers.

  • A type qualifier is written along with declaring a variable. If specifies the additional qualification of the variable. Following are the type qualifiers in C:
  • const   signed    unsigned   long   short   volatile
type qualifiers in c, type qualifiers in c geeksforgeeks, how many data type qualifiers in c, what are different types of qualifiers, explain type qualifier, type qualifiers and type modifiers in c, size qualifiers in c, volatile qualifier in c, qualifiers in c geeksforgeeks, ox2fa which type of constant it is, signed and unsigned qualifiers in c, type modifiers in c, restrict qualifier in c, the c language defines fundamental data types, quantifiers c programming, which of the following does not store a sign?, what is a lvalue and rvalue?, type qualifiers in c geeksforgeeks, volatile qualifier in c, restrict type qualifier in c,
Image Source ~ Crafted With ©Ishwaranand – 2020 ~ Image by ©Ishwaranand
For e.g 
  • unsigned int K;
  • unsigned specify that we want the variable without a sign. It does not allow negative values. So variable ‘K’ can contain only a positive value.

Creating Constants

Q) Explain with an example of how constants are created.

  • A constant is an entity whose value cannot be changed during the execution of the program. In C constants are created using const keyword. Following is the syntax for creating constantly.
  • Const data_type constant_name = value;
E.g.
  • const int MAX = 30;
  • const float PI = 3.14;

Q) Write a program to accept the radius of the circle. Calculate & display the area & circumference of the circle

#include <stdio.h>
void main()
{

const float PI=3.14;  /* PI is constant */
int r;
float area, circum;
printf(“enter values of radius : “);
scanf(“%d”, &r);
area = PI*r*r;
circum = 2*PI*r;
printf(“nArea = %f”, area);

printf(“nCircumference = %f”, circum);
}
Output:
Enter values of radius: 10
Area = 314.000000
Circumference = 62.800000

Last updated on Sunday - May 21st, 2023

.