C only have functions, constants, defined types, macros and global variables (albeit rare, because it is inadvisable). One way to find the information is to look at the header ( .h
) files where you have the declarations.
I do not advise trying to learn this way in any language. Better to look for a more structured, probably a good book. It is even possible for a person to create their own study method if they already have a good programming domain and are strongly self-taught with a proven structure. Do not try to guess what things are doing, learn what they really do and how to use it. programming can not be based on shrewdness, voluntarism and trial and error. Look for the documentation. This is the trick.
Just to complement, since the question does not talk about it, but the other answer is misleading : C, like Python, has types for all data. C, unlike Python, has types for all variables. The types available in C are: char
, signed char
, unsigned char
, short
, unsigned short
, int
, unsigned int
, long
, unsigned long
, long long
float, double, unsigned long long
, long double
, or _Bool
(available in virtually all compilers), bool
, struct
, array, and pointer.
There are still some purely library-defined types, including (not all) union
, size_t
, intN_t
, int_leastN_t
, int_fastN_t
, intptr_t
, included in intmax_t
and <inttypes.h>
.
Pointers and arrays end up somewhat confusing .
Pointers, just like arrays , are always used in composition with other types. It serves both as a reference for a type and for indicating a sequence of data of its type. The pointer can be composed even with functions. The string concept only exists even in the literal quoted and some functions in <stdint.h>
, in the background it's just a pointer to <string.h>
.
You can create your own types, usually through char
and struct
.
I understand what the other answer meant, but it's good to make it clear that typedef
of Python has a very different semantics than dict
. Actually I think a better comparison would be the Python class with the C structure. At least in the simplest form of the class, it looks like a struct
, although it does not give the same guarantees. In fact the way to simulate a class in C is with struct
. Simulating a struct
requires something even more complex on its own or using a ready library.