C Language Undefined Behavior
Copying Overlapping Memory
Most of these functions have undefined behavior when the source and destination regions overlap. Its definition specifies that the function behaves as if the source data were first copied into a temporary buffer and then written to the destination address.
How does strtoul
work?
The strtoul()
function converts the initial part of the string in nptr
to an unsigned long value according to the given base.
What is uint32_t
in C?
uint32_t
is a numeric type that guarantees 32 bits and is unsigned, with values ranging from 0 to 2^32 – 1.
What is memset
in C?
memset()
is used to fill a block of memory with a particular value.
What is strrchr
in C?
The strrchr()
function locates the last occurrence of a character in a string.
What is the Size of char
in C?
Integer Types | Storage size | Value range |
---|---|---|
char |
1 byte | -128 to 127 or 0 to 255 |
unsigned char |
1 byte | 0 to 255 |
signed char |
1 byte | -128 to 127 |
int |
2 or 4 bytes | -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647 |
How do you use isalpha
?
The isalpha()
function checks whether a character is an alphabet or not, returning 0 if the parameter isn’t an alphabet and a nonzero number if it is an alphabet.