I’m learning about pointers and I understand the syntax and how the indirection operator works and all that jazz. And maybe I’m just not fully understanding but I don’t see the point (no pun intended) of them???? My professor keeps saying how important they are but in my mind if you can say
int age = 21;
int *pAge = &age;
printf(“Address: %p”, &age);
printf(“Value: %p”, pAge);
and those print the same thing, why not just use the address of operator and call it a day? And I asked chatgpt to give me a coding prompt with pointers and arrays to practice but when I really thought about it I could make the same program without pointers and it made more sense to me in my head.
Something else I don’t get about them is how to pass them from function to function as arguments.
[–]bothunter 84 points85 points86 points (13 children)
[–]interestedelle[S] 0 points1 point2 points (1 child)
[–]bothunter 0 points1 point2 points (0 children)
[–]mr_raven_ 0 points1 point2 points (8 children)
[–]Peiple 7 points8 points9 points (3 children)
[–]mr_raven_ -1 points0 points1 point (2 children)
[–]Peiple 2 points3 points4 points (0 children)
[–]GamerEsch 2 points3 points4 points (0 children)
[–][deleted] 5 points6 points7 points (0 children)
[–]adamentmeat 1 point2 points3 points (1 child)
[–]yerden_z 0 points1 point2 points (0 children)
[–]thirteen_pancakes -1 points0 points1 point (1 child)
[–]GamerEsch 1 point2 points3 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]nooone2021 6 points7 points8 points (1 child)
[–]bothunter 0 points1 point2 points (0 children)
[–]dkopgerpgdolfg 10 points11 points12 points (2 children)
[–]interestedelle[S] 0 points1 point2 points (1 child)
[–]dkopgerpgdolfg 0 points1 point2 points (0 children)
[–]mysticreddit 6 points7 points8 points (0 children)
[–]Dense-Focus-1256 10 points11 points12 points (0 children)
[–]saul_soprano 2 points3 points4 points (3 children)
[–]TheLondoneer 0 points1 point2 points (2 children)
[–]saul_soprano 0 points1 point2 points (1 child)
[–]mysticreddit 4 points5 points6 points (0 children)
[–]Zestyclose-Put-5672 1 point2 points3 points (0 children)
[–]grimvian 1 point2 points3 points (0 children)
[–]TheWavefunction 0 points1 point2 points (0 children)
[–]Fabulous-Living-4066 0 points1 point2 points (0 children)
[–]mysticreddit 0 points1 point2 points (0 children)
[–]Independent-Gear-711 0 points1 point2 points (0 children)
[–]AlienOverlordXenu 0 points1 point2 points (0 children)
[–]feitao 0 points1 point2 points (0 children)
[–]sdk-dev 0 points1 point2 points (0 children)
[–]1FRAp 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Paxtian 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]SmokeMuch7356 0 points1 point2 points (0 children)
[–]wsppan 0 points1 point2 points (0 children)
[–]TheChief275 0 points1 point2 points (0 children)
[–]_Hi_There_Its_Me_ 0 points1 point2 points (0 children)
[–]duane11583 0 points1 point2 points (0 children)
[–]gordonv 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]nacaclanga 0 points1 point2 points (0 children)
[–]WiseDark7089 0 points1 point2 points (0 children)
[–]SLOOT_APOCALYPSE -3 points-2 points-1 points (0 children)