Saturday, 8 July 2017

c - How to change a variable in a calling function from a called function?

How should the try() function be modified (and it's call) to get the output as 11 from the program below?




#include 

/* declare try() here */

int main(void)
{
int x = 10;
try(); /* Call can change */
printf("%d\n", x);
return 0;

}

void try() /* Signature can change */
{
/* how to change x here?? */
}

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...