How the FUCK do pointers work? what's the point of them? why or how should i use them?

how the FUCK do pointers work? what's the point of them? why or how should i use them?

Attached: c.png (1200x1276, 77K)

Other urls found in this thread:

m.youtube.com/watch?v=Zn8OJMYT-gc
youtube.com/watch?v=f-pJlnpkLp0
lambda-the-ultimate.org/node/4222
youtube.com/watch?v=uNjxe8ShM-8
twitter.com/NSFWRedditImage

Don't. Program in HTML.

Program in x86 assembly or you are an gaye lole

>HTML
>Programming language

It's an integer that stores a memory address.

we had this same thread yesterday or the day before, I forget

m.youtube.com/watch?v=Zn8OJMYT-gc

A pointer points to another valure in memory. So if you make a regular int variale and set it equal to 5, then create 20 pointers to it, all 20 pointers would resolve to 5. But then if you go back to your original variable and set it equal to 6, now you have 20 pointers that resolve to 6. It can get a little more complicated than that, but thats the gist of it.

Here's a video explanation for brainlets:
youtube.com/watch?v=f-pJlnpkLp0

>how the FUCK do pointers work?
They work by pointing.
>what's the point of them?
The point is to point.
>why or how should i use them?
You should use them when you need to point. Don't use them when you don't need to point.

int *p is a memory address
p = &x sets p to the address of x
*p reads from the address it points at
*p = 123 writes to that address
*p++ increments what's at the address
p++ increments the address so it points to whatever's at the next address

Consider your home. Your home is a pretty large thing. Its postal address is like a pointer. When you buy a dragon dildo from Amazon, you don't uproot your house and take it with you to a warehouse in Tennessee. You give amazon your postal address so they can deliver it to you.

Say you have a variable named Moot, and you want to find out where Moot lives.
You just do &Moot. This returns the address (pointer) to Moot.
Now say you have a pointer called Fagland.
You then can do *Fagland to see who lives there.

Say you want to find out who moots neighbour is
You take Moots address, and add one to it.
(&Moot+1)
now you just need to find out who lives there, so you do
*(&Moot+1)

HTML is Turing complete, no?

*p++ return the value of the address and then increments p.

How do you loop in HTML? You have to be able to do something an arbitrary amount of times to be turing complete.

Hey, the L stands for Language! But that was sarcasm.

Turing engines are a description of hardware not programming languages

If you've ever used a successful scanf call that didn't just throw characters away you've used a pointer

Turing completeness means that a turing machine's operations can be implemented using a language or other thing. A turing machine has been proven to be able to perform any calculation given enough length of tape, so a turing complete language or other thing can too.

If you've ever worked with a string in C, you've used a pointer.
If you've ever got arguments off the command line, you've used a pointer.
If you've ever used fopen, fread, fwrite, fclose, you've used a pointer.

If you've ever used a pointer, you've used a pointer.

HTML+CSS is Turing complete
lambda-the-ultimate.org/node/4222

If you've ever used the finger next to your thumb, you've used a pointer.

Use them if you want to alter data in other functions

CSS is cheating. I wanted to see in plain HTML.

So its better for when you're going to be working with a variable that you're running through multiple functions that may need to get tweaked

I'm completely new to c and dont understand programming well enough but wouldn't pointers also be good for if you were using user input because it just calls back to the original definition

Pointers should only be used by smart people. You should stick with Python.

WTF?!

thats not much of an achievement, powerpoint is turing complete after all

youtube.com/watch?v=uNjxe8ShM-8

Thank you for this summary. Just one question, I went through a C++ tutorial which implied that this:
int *p = &x;
Is the same as this:
int *p;
p = &x;Which never made sense to me, is it correct? In the first you're declaring and assigning *p to &x, in the second you're declaring *p but assigning p (no star) to &x.

>what’s the point of them
a memory cell heheheheheh

Yes it's correct. It being a pointer is part of the type, I eman if you do something like
int a;
a = 4;

you don't have to repeat the type either. Once you declared p to be of type int pointer, you don't have to repeat it in an assignment.

Some don't like writing it that way but maybe it makes more sense to you if you write it like this
int* p;
p = &x;

Now it's clearer that the star is part of the type.

Pointers are intuitively simple if you have ANY clue about how RAM is organized. They are not a problem, they are a solution to various problems.

Pointer is simply variable containing a memory address of another variable. Its such a simple concept... I dont get why so many people have problems with them.

when use triple pointers

3 dimensional arrays.

Ahhh now I see it. Thanks.

*p++ doesn't do what you meant it to, you should use ++*p