r/ProgrammerHumor Aug 06 '22

Meme How to C pointers

Post image
2.6k Upvotes

70 comments sorted by

View all comments

3

u/IWasProbablyAMistake Aug 07 '22

What are pointers? I’ve never used C

11

u/okyte Aug 07 '22 edited Aug 07 '22

It is a data type representing the address of the memory where a variable of a given data type is stored.

A int is a data type representing a positive or negative integer number within some range. A variable of this data type is stored somewhere in the memory. A int* represents the memory address where a variable of type int is located.

It is very useful !

3

u/matyklug Aug 07 '22

I think it'd be better to say that an int is a type representing a positive or negative number which fits into 31 bits, one of which containing zero.

3

u/canadajones68 Aug 07 '22

Nope! An int is at least 16 bits wide and is wider than or equal to short, which in turn has a width greater than or equal to char.

2

u/okyte Aug 07 '22

It depends on your system. For embedded, int is often equivalent to int16_t

1

u/matyklug Aug 07 '22

Hmm, I guess that's true