int i = 4; // (32-bit) signed integer double d = 2.0; // (64-bit) real number char c = 'x'; // '\n' is a character, too char c[30] = "This could be a string"; // character array = string int a[10]; // an array of 10 integers (indices from 0 to 9) struct Person { char lastName[30]; char firstName[20]; int yearOfBirth; }; // a structure, containing several primitive data types
'\0'
, so a
char c[30]
fits strings of length up to 29.
Person onePerson; onePerson.lastName = "Doe"; onePerson.firstName = "John"; onePerson.yearOfBirth = 1972;