Friday, September 12, 2008

C vs Python

Give a code snippet that is valid in both C and Python, but produces
different results.

1 comment:

Kundan said...

#define print(a) printf(10)
print(20)

In C, this prints 10 because of the macro subtitution, but in Python
it prints 20 because the line starting with # is ignored as a comment.