Answers for "c programm pointer change in function"

0

c programm pointer change in function

void change(int **p, int *someOtherAddress) // **p *b allazei o p kai deixnei sto b //
{
    *p = someOtherAddress;
}

int a = 1, b = 2;
int *p = &a;

printf("*p = %d\n", *p);
change(&p, &b);
printf("*p = %d\n", *p);
Posted by: Guest on February-19-2021
0

c programm pointer change in function

int* change_adrs(int *q) //me return kai anathesh: p=returned kai synarthsh me mesa *kati=&x x=5;//
      {                  //xwris reference, by value.Epistrefei apla dieythynsh kathorismenh sthn synarthsh panta to 875002//
      int * otheraddess;
      q = otheraddress;
      return q; 
      }


int main()
{
 p=change_adrs(p);
 return 0;
}
Posted by: Guest on February-19-2021
0

c programm pointer change in function

void foo(int** p) {     //*p p den allazei , *p **p allazei! deikse null //
      *p = NULL;  /* set pointer to null */
 }
 void foo2(int* p) {
      p = NULL;  /* makes copy of p and copy is set to null*/
 }

 int main() {
     int* k;
     foo2(k);   /* k unchanged */
     foo(&k);   /* NOW k == NULL */
 }
Posted by: Guest on February-19-2021

Browse Popular Code Answers by Language