0

what is the point-er ?

I read a lot about pointers and references but I still cant understand why do we use them or when do I use them or how do they even work so if anyone can help me with that I'd be very thankful. sorry for the pun tho but couldn't resist myself :)

7th Nov 2022, 8:06 AM
JagdTiger
JagdTiger - avatar
1 Answer
+ 4
Its a huge topic actually.. But leme give you an insight where you'll really use pointers ... So lets say you're making an operating system and you want to display some text on screen ..You can't do std::cout since there's no C++ std lib at this level ..... You just have basic control over memory and stuff like looping , conditions etc ... you cant #include anything* ... So what you can do is write to some part of memory ( vga text buffer ) to get some pixels turned on .. you do it by pointer .. something like unsigned char* video_address=(unsigned char*) 0xb8000; *video_address='c'; This would print c on screen. Without pointers it wouldn't be possible.
7th Nov 2022, 8:31 AM
Prashanth Kumar
Prashanth Kumar - avatar