Whats the point of pointers?

Whats the point of pointers?

Attached: pointer_memory_representation.png (500x300, 32K)

Pointing to other stuff.

High-level representation of memory addresses.

WHEN A FUNCTION ENDS IT DELETES THE STACK AKA THE REFERENCES TO LOCAL VARIABLES, SO IF YOU STILL WANT TO ACCESS THESE LOCAL VARIABLES AFTER THE FUNCTION IS RAN YOU NEED TO USE POINTERS

oh ok. thanks!

Thanks based boomer grandpa with caps lock

To point functions and then you don't need to pass whole function thru arguments.

This. They point to a memory address in your current virtual memory space, or to a physical memory address if you're doing bare metal stuff. On some architectures they could also hold some metadata about the address to help with memory management (tagged pointers)

autism

all modern languages operate on pointers by default

Instead of moving the turing machine head frame by frame, you can make it skip to exactly the place you want, so you read/write data at constant complexity rather than linear.

but hey are deleted after the function ran, how can you have valid reference to them?

I can't tell if this is bait or not, but this is completely wrong.

And that's a bad thing.

the power of prayer

C doesn't have references, so instead you use the memory address of a variable rather than a reference. Pointers are variables that hold memory addresses.

dumbass

/thread

>other stuff
void* ptr;
ptr = (void*) &ptr;

braindead nigger

ancient low level shit that 99% of programmers won't effectively use today. It's great for leaning how to program tho.

then goto is based right?

THIS IS WRONG BUT IT WORKS, AT LEAST IN SOME OLDER LANGUAGES THAT DON'T CLEAN UP AFTER THEMSELVES

memory control
reference

References but for autists

ptr points to an uninitialized address on the stack after this. The zero-sized array GNU extension would have been a better example.

Fucking autists in this thread and OP is retarded

Don't want to copy structs as arguments? Use pointers.
Want to use the heap AT ALL? Use pointers.
Want to iterate through an array? Use pointers. array[1] is syntax sugar for *(array+1)

>ptr points to an uninitialized address on the stack after this
it is initialized to its own address.

>ptr points to an uninitialized address on the stack after this.
See

>ptr points to an uninitialized address on the stack after this.
No, it doesn't.

int a;
int* p = &a;
*p = 3;
printf("%d\n", a);