anonymous
  • anonymous
i was wondering if we can do this in c........... we can write a function to change the value of a variable like .... void change(int *x) { *x=3; return; } and call wud be smthin like change(&x); can we do the same for an array?
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
jamiebookeater
  • jamiebookeater
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
I don't see any reason why not. It will still be a pointer to memory.
anonymous
  • anonymous
can u write some code for me?
anonymous
  • anonymous
void change(char *x) { *x[1]='foo'; return; }

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
umm lemme see if that works
anonymous
  • anonymous
it's not working
anonymous
  • anonymous
and the error is?
anonymous
  • anonymous
Have you tried void change(char *x) { x[1]='foo'; // <-- without the * return; }
anonymous
  • anonymous
by the way... the calling function will be change(foo) not change(&foo)
anonymous
  • anonymous
ooo
anonymous
  • anonymous
that wont worjk either
anonymous
  • anonymous
no worries got it covered and it's not
anonymous
  • anonymous
............

Looking for something else?

Not the answer you are looking for? Search for more explanations.