Getting Started

(lily) #1

Chapter 8: C Pointers and Arrays


void func1()

func2 it is equal ‘n’, but this change has no effect on
in both functions is pure coincidence. We could

}

ut Let’s define:

e it

{
char olay = ‘m’;
...
func2(olay);
...
}


void func2(char olay)
{
...
olay++;
...
}


After olay is incremented in
olay in func1. The name ‘olay’
have func2:


void func2(char yalo)
{
...
yalo++;
...


and accomplished the same task.


B


void func2(char *)

Then us


void func1()
{
char olay = ‘m’;
...
func2(&olay); // give func2 the address of the variable olay
...
}

Free download pdf