The Horror of pointers...

Joined
Jan 11, 2025
Messages
2
Reaction score
0
Hello People,

I'm quite a bit struggling with Pointers. I just can't get my head around the whole matter of it.
The studybooks start to explain it from a startof point which is already beyond my knowledge so I was lagging behind right from the start.

Of course, after drilling myself by reading the chapters over and over again, along with helpfull youtube content, there eventualy is a certain basic knowledge on this in my head now, but I need some clarification or ratification of my assumptions and that I understand things right.

Also, if one has links to proven to be good Youtube content on this, I would be gratefull.
I found a video by an Indian woman explaining it in a way I could manage somewhat. But the accent, even though only less than normaly noticable, was distracting in a way I therefor needed a fraction of a second to understand the sentence, before being able to catch up.
:confused:

I have a piece of code which contains a few pointer thingy's. So something to tear appart to see what it is doing.
Can someone explain step by step what is going on here?

#include <stdio.h>
void twofold (int *single, int *duble); //"double" is a prohibited word. Therefor "duble"
void twofold (int *single, int *duble)
{
*duble = 2 * *single;
*single = 4 * *duble;
}
void main()
{
int n=3, result ;
twofold (&n, &result);
printf("%6d %6d", n, result);
n = n+1;
twofold(&n, &result);
printf("%6d %6d", n, result);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,824
Members
47,370
Latest member
desertedtyro29

Latest Threads

Top