changing a value of a variable

Karl M. Syring syring at email.com
Wed Jan 30 06:30:52 EST 2002


"Aahz Maruch" <aahz at panix.com> schrieb
> In article <dbaf973c.0201291630.273edb44 at posting.google.com>,
> Marcin Matuszkiewicz <marcinm at finisar.com> wrote:
> >How to write a python program that accomplishes the same thing as the
> >C program below.
> >
> >void assign(int *x)
> >{
> >  *x = 1;
> >}
> >
> >int main(void)
> >{
> >   int n = 0;
> >
> >   /* n == 0 */
> >   assign(n);
> >   /* n == 1 */
> >
> >   return 0;
> >}
>
> Did you try compiling and running this C program?

Works as advertised:
gcc -o crash crash.c
crash.c: In function `main':
crash.c:11: warning: passing arg 1 of `assign' makes pointer from integer
withou
t a cast
crash
crash.exe caused an Access Violation at location 00401212 in module
crash.exe Writing to location 00000000.

Karl M. Syring




More information about the Python-list mailing list