Comp120 example: Data Types and Values

Run Settings
LanguageC
Language Version
Run Command
/* * Experiments and demos for Data Types and Values * * Author: J. Fall * Date: Jan. 2017 **************************************************************************/ #include <stdio.h> #include <stdbool.h> int main() { // Initialization int i = 42; char c = 'A'; float f = 123.987; char* s = "Hello World"; bool b = true; printf("Data values: %d, %c, %f, %s, %s \n",i, c, f, s, b?"true":"false"); // type casting to char printf("char values: '%c', '%c', '%c', '%c', '%c' \n",(char)i, (char)c, (char)f, (char)s, (char)b); // type casting to int printf("int values: %i, %i, %i, %i, %i \n",(int)i, (int)c, (int)f, (int)s, (int)b); // type casting to bool printf("bool values: %s, %s, %s, %s, %s \n",(bool)i?"true":"false", (bool)c?"true":"false", (bool)f?"true":"false", (bool)s?"true":"false", (bool)b?"true":"false"); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines