Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Semrush - keyword research tool

Create your online store today with Shopify

Turn ChatGPT, Claude, Gemini, And CoPilot Into Your Personal Assistant, Business Coach, Content Creator, And More

AFFILIATE MARKETING Your all-in-one performance engine Manage affiliates, creators, and customer referrals in one unified platform—turning every partnership into measurable growth

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Disclosure: My content contains affiliate links.

43,700 questions

57,013 answers

573 users

How to pass the address of a pointer to a pointer to a function in C

1 Answer

0 votes
#include <stdio.h>
  
void changeValue_p(int** p) {
    **p = 700;
}

void changeValue_pp(int*** ppp) {
    ***ppp = 398;
}

int main()
{
    int n = 12;
    
    int* p = &n;
    printf("%d %d\n", *p, n);
    changeValue_p(&p);
    printf("%d %d\n", *p, n);
    
    int** pp = &p;
    printf("%d %d\n", **pp, n);
    changeValue_pp(&pp);
    printf("%d %d\n", **pp, n);
    
    return 0;
}

       
       
/*
run:
     
12 12
700 700
700 700
398 398
        
*/

 



answered Jun 20, 2024 by avibootz

Related questions

1 answer 228 views
1 answer 169 views
1 answer 226 views
1 answer 255 views
1 answer 246 views
1 answer 219 views
...