C Programming Language Flashcards
tokens
A C program consists of various tokens and a token is either a keyword, an identifier, a constant, a string literal, or a symbol.
a statement terminator
semicolon
each individual statement must be ended with
a semicolon
a name used to identify a variable, function, or any other user-defined item
identifier
C does not allow _ within identifiers
punctuation characters such as @, $, and %
Is C case-sensitive?
YES
A C compiler totally ignores __
A line containing only whitespace, possibly with a comment, a blank line,
Categories of types in C
basic, enumerated, void, derived
char (bytes, range)
1 byte, -128 to 127 or 0 to 255
unsigned char (bytes, range)
1 byte, 0 to 255
signed char (bytes, range)
1 byte, -128 to 127
int (bytes, range)
2 or 4 bytes, -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647
unsigned int (bytes, range)
2 or 4 bytes, 0 to 65,535 or 0 to 4,294,967,295
short (bytes, range)
2 bytes, -32,768 to 32,767
unsigned short (bytes, range)
2 bytes, 0 to 65,535
long (bytes, range)
8 bytes or (4bytes for 32 bit OS) , -9223372036854775808 to 9223372036854775807
unsigned long (bytes, range)
8 bytes, 0 to 18446744073709551615
float (bytes, precision)
4 byte, 6 decimal places
double (bytes, precision)
8 byte, 15 decimal places
long double (bytes, precision)
19 decimal places
three situations for void
functions returning void, function arguments as void, pointers to void
A pointer of type void * represents
the address of an object, but not its type
what is a variable?
A variable is nothing but a name given to a storage area that our programs can manipulate.
basic types of variables
char, int, float, double, void
At what time does a variable definition have its meaning?
compilation time
extern keyword
declare a variable at any place. Though you can declare a variable multiple times in your C program, it can be defined only once in a file, a function, or a block of code.
Two types of C expressions
lvalue and Rvalue
lvalue
Expressions that refer to a memory location; can be on left side or right side
rvalue
refers to a data value that is stored at some address in memory. An rvalue is an expression that cannot have a value assigned to it which means an rvalue may appear on the right-hand side but not on the left-hand side of an assignment.