uint8_t vs unsigned char

It documents your intent – you will be storing small numbers, rather than a character. Also it looks nicer if you’re using other typedefs such as uint16_t or int32_t.

what is Segmentation fault (core dumped)? [duplicate]

“Segmentation fault” means that you tried to access memory that you do not have access to. The first problem is with your arguments of main. The main function should be int main(int argc, char *argv[]), and you should check that argc is at least 2 before accessing argv[1]. Also, since you’re passing in a float … Read more

Categories C Tags

What is size_t in C?

According to the 1999 ISO C standard (C99), size_t is an unsigned integer type of at least 16 bit (see sections 7.17 and 7.18.3). size_tis an unsigned data type defined by several C/C++ standards, e.g. the C99 ISO/IEC 9899 standard, that is defined in stddef.h.1 It can be further imported by inclusion of stdlib.h as … Read more

pthread_join() and pthread_exit()

In pthread_exit, ret is an input parameter. You are simply passing the address of a variable to the function. In pthread_join, ret is an output parameter. You get back a value from the function. Such value can, for example, be set to NULL. Long explanation: In pthread_join, you get back the address passed to pthread_exit by the finished thread. If you pass just a plain … Read more

What does (~0L) mean?

0L is a long integer value with all the bits set to zero – that’s generally the definition of 0. The ~ means to invert all the bits, which leaves you with a long integer with all the bits set to one. In two’s complement arithmetic (which is almost universal) a signed value with all bits set to one is -1. The reason for … Read more

What is *(uint32_t*)?

uint32_t is a numeric type that guarantees 32 bits. The value is unsigned, meaning that the range of values goes from 0 to 232 – 1. This declares a pointer of type uint32_t*, but the pointer is uninitialized, that is, the pointer does not point to anywhere in particular. Trying to access memory through that pointer will cause … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)