r/C_Programming • • Apr 24 '24

The way C Programers explain pointers

https://imgs.xkcd.com/comics/pointers.png
652 Upvotes

50 comments sorted by

View all comments

Show parent comments

-5

u/lokithegregorian Apr 24 '24

"Pointer" is a lexeme of all programming languages. Like "instantiate," "reference," "object," or "value." It is the object holding your reference (usually to memory). It has a size. I can set other variables equal to it. I can pass it in functions. I can operate on the pointer, with or without de-referencing said pointer.

It doesn't matter what the language calls them. They are simply rebranding a pointer.

https://en.wikipedia.org/wiki/Pointer_(computer_programming)

7

u/erikkonstas Apr 24 '24

This is incorrect; for example, Python doesn't have pointers at all.

0

u/lokithegregorian Apr 24 '24

You are a self taught coder.

The python interpreter uses pointers all the time. A list or an array in python? That's just pointers to a list of pointers. Python saves you that trouble. It also denies you the power that comes with controlling the granularity. C, does not. C gives you live ammo, and trusts you to not shoot yourself.

It's not even that it trusts you. It trusts you no more than a rock and a high cliff trusts you. The makers never cared what you would do with it. You can shoot yourself all day. You want a safety? Make one with C and make a library that you reference. You'll want to use "pointers" in that solution; they make for cheap data integrity.

2

u/erikkonstas Apr 24 '24

Yes, I do agree that the CPython implementation uses pointers. The language itself still has no pointers. Java is another language with no pointers.

1

u/lokithegregorian Apr 24 '24

What does the python interpreter use to pass objects that hold memory references? And that name, it may be a label, that references a computer science term. What term is that?

2

u/erikkonstas Apr 24 '24

Exactly, the interpreter... not the language itself!

1

u/lokithegregorian Apr 24 '24

Python is an interpreted language. Because of that, the language does not exist without the compiler.

...unlike C. xD

3

u/erikkonstas Apr 24 '24

The language itself is not the same as its implementation; rather, it is defined by its specification. Otherwise, C wouldn't "exist" without a compiler either!

→ More replies (0)