how to pass by reference??

Erno Kuusela erno-news at erno.iki.fi
Mon Feb 4 05:43:55 EST 2002


In article <a3knt6$gr3$1 at news.efn.org>, "Spencer Doidge"
<spencer at spencerdoidge.com> writes:

| I really tried to RTM first this time, but I failed.
| Can someone give me a hint where in the doc html's it explains how to pass
| by reference?
| Specifically, I want to do the equivalent of this:

| char s[10];

| void foo(char *bfr)
| {
|     bfr[0] = 'a';
|     bfr[1] = 'b';
|     return;
| }

| void main(void)
| {
|     foo(s);
|     return;
| }

s = [''] * 10

def foo(bfr):
    bfr[0] = 'a'
    bfr[1] = 'b'

def main():
    foo(s)
    return

  -- erno





More information about the Python-list mailing list