-
-
Save sutirthaC97/4bde74331a20b57d11c7e62f066b37ae to your computer and use it in GitHub Desktop.
An example C program demonstrating different data types, their variables and their naming conventions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*An example C program to demonstrate different data types.*/ | |
#include <stdio.h> | |
int main() | |
{ | |
int meaningOfLife = 42; | |
float a_random_float = 56.9; | |
double pi = 3.141; | |
char c = 'c'; | |
printf("\nThe integer meaningOfLife holds the value: %d and it's size is: %d", meaningOfLife, sizeof(meaningOfLife)); | |
printf("\nThe float a_random_float holds the value: %f and it's size is: %d", a_random_float, sizeof(a_random_float)); | |
printf("\nThe double pi holds the value: %lf and it's size is: %d", pi, sizeof(pi)); | |
printf("\nThe character c holds the value: %c and it's size is: %d", c, sizeof(c)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment