What is the use of intptr_t?

The primary reason, you cannot do bitwise operation on a void *, but you can do the same on a intptr_t. On many occassion, where you need to perform bitwise operation on an address, you can use intptr_t. However, for bitwise operations, best approach is to use the unsigned counterpart, uintptr_t. As mentioned in the … Read more

I’m getting “Invalid Initializer”, what am I doing wrong?

You can’t initialise revS in that manner, you need a very specific thing to the right of the =. From C11 6.7.9 Initialization /14, /16: 14/ An array of character type may be initialized by a character string literal or UTF−8 string literal, optionally enclosed in braces. Successive bytes of the string literal (including the … Read more

How to use timer in C?

You can use a time_t struct and clock() function from time.h. Store the start time in a time_t struct by using clock() and check the elapsed time by comparing the difference between stored time and current time.

strcmp not working

You want to do this: strcmp(buffer, “exit\n”) That is, when you enter your string and press “enter”, the newline becomes a part of buffer. Alternately, use strncmp(), which only compares n characters of the string

Typedef function pointer?

typedef is a language construct that associates a name to a type.You use it the same way you would use the original type, for instance using them like As you can see, you could just replace the typedefed name with its definition given above. The difficulty lies in the pointer to functions syntax and readability … Read more