C - Programming Language
This course covers the basics of programming in C. Work your way through the videos and we'll teach you everything you need to know to start your programming journey!

Data Types

Lesson 7
Author : Mike Dane
Last Updated : November, 2017


Code

Copychar testGrade = 'A';    // single 8-bit character.
char name[] = "Mike";    // array of characters (string)

// you can make them unsigned by adding "unsigned" prefix
short age0 = 10;         // atleast 16-bits signed integer
int age1 = 20;           // atleast 16-bits signed integer (not smaller than short)
long age2 = 30;          // atleast 32-bits signed integer
long long age3 = 40;     // atleast 64-bits signed integer

float gpa0 = 2.5;        // single percision floating point
double gpa1 = 3.5;       // double-precision floating point
long double gpa2 = 3.5;  // extended-precision floating point

// boolean
int isTall;              // 0 if false, non-zero if true
isTall = 1;

testGrade = 'F';

printf("%s, your grade is %c \n", name, testGrade);