12/06/2023 9:16 am
Topic starter
Notifications
Clear all
How to create recursive loop using pointers?
0
How to create recursive loop using pointers?
Answer
Add a comment
Add a comment
1 Answer
0
13/06/2023 7:51 pm
you want to alter a variable given in the parameter list. You can do so by using pointers. For example:
void move(int *pa)
{
(*pa)++; // increase the counter by one
if (*pa < 5) move(pa);
}
void main(void)
{
int a = 0;
move(&a);
}
Add a comment
Add a comment
Forum Information
- 14 Forums
- 1,835 Topics
- 5,051 Posts
- 1 Online
- 1,078 Members
Our newest member: Richardnop
Latest Post: loli
Forum Icons:
Forum contains no unread posts
Forum contains unread posts
Topic Icons:
Not Replied
Replied
Active
Hot
Sticky
Unapproved
Solved
Private
Closed