int main() {
int a = 10;
float b = 20.5;
char c = 'X';
double d = 15.75;
const char *str = "Hello";
return 0;
}
int a = 10;
: This line declares an integer variable named a
and initializes it with the value 10
.float b = 20.5;
: Here, a floating-point variable named b
is declared and initialized with the value 20.5
.char c = 'X';
: Declares a character variable named c
and assigns it the character 'X'
.double d = 15.75;
: This line declares a double-precision floating-point variable d
and initializes it with the value 15.75
.const char *str = "Hello";
: Declares a constant pointer named str
pointing to a string literal "Hello"
. The const
keyword indicates that the content pointed to by str
cannot be modified.