tell me the difference between functions in python and functions in c?

In C/C++, the main() function is the program entry point.

In python their is no such main() functions which are the program entry point and don’t automatically run unless they are called. But the behaviour cam be implemented.

def main():
  # Your code

if __name__ == '__main__':
  main()

Then main() will run if script is executed (not imported)

Also python does not require main() functions like C++, all code in the script outside any function (which is not called) is executed

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top