char: a single byte, capable of holding one character in the local character setint: integer, typically reflecting the natural size of integers on the host machinefloat: single-precision floating-pointdouble: double-precision floating-pointshort and long apply to integers. short and long should provide different lengths of integers. Usually, short is 16 bits long, int will be the natural size for a particular machine (32 or 16 bits), and longs are at least 32 bits. But always: long>int>short.signed and unsigned can be applied to char or any integer. unsigned numbers are always positive or zero. Whether chars are signed or unsigned is machine-dependent, but printable character are always positive.long double specifies extended-precision floating point.sprintf(): Convert a number to a stringstrtol(): (String-to-long) family:
strtol(): String to long intstroll(): String to long long intstrtoul(): String to unsigned long intstrtof(): String to floatstrtod(): String to doubleatoi(): String to intatof(): String to floatatol(): String to long intatoll(): String to long long intvoid: int foo(void)main() arguments:
argc: Argument count, including the program name.argv: String of all the arguments. The last argument is a pointer to NULLAccessing every member:
saturn.name = "Saturn SL/2";
saturn.price = 15999.99;
saturn.speed = 175;
With {}: struct car saturn = {"Saturn SL/2", 16000.99, 175};
With: struct car saturn = {.speed=172, .name="Saturn SL/2"};
-> or .:
.).->).Typedef: Basically, you take an existing type and you make an alias for it with typedef.
**typedef** int antelope; *// Make "antelope" an alias for "int"*
The correct way to use typedef with structs is to define them as we rename them:
typedef struct animal {
char *name;
int leg_count, speed;
} animal;
// From now on to use this struct we only need to:
animal cat;
\\0)