Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. simple question

simple question

Scheduled Pinned Locked Moved C#
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Trustapple
    wrote on last edited by
    #1

    hi , this may sound very stupid but i want some body to explain to me what is the difference between public static void Main() { } AND public void Main() { } what is the purpose of using void in the main function ie anyway a main function doesnot have to return any values right :D expecting a reply at the earliest j

    A S 2 Replies Last reply
    0
    • T Trustapple

      hi , this may sound very stupid but i want some body to explain to me what is the difference between public static void Main() { } AND public void Main() { } what is the purpose of using void in the main function ie anyway a main function doesnot have to return any values right :D expecting a reply at the earliest j

      A Offline
      A Offline
      Andrei Ungureanu
      wrote on last edited by
      #2

      Trustapple wrote:

      expecting a reply at the earliest

      Read this [^] article.

      Trustapple wrote:

      what is the purpose of using void in the main function ie anyway a main function doesnot have to return any values

      You use void to let the compiler know that the function doesn't return any values.

      There are 10 kinds of people: those who understand binary and those who don't

      1 Reply Last reply
      0
      • T Trustapple

        hi , this may sound very stupid but i want some body to explain to me what is the difference between public static void Main() { } AND public void Main() { } what is the purpose of using void in the main function ie anyway a main function doesnot have to return any values right :D expecting a reply at the earliest j

        S Offline
        S Offline
        Sandeep Kumar
        wrote on last edited by
        #3

        Hi..

        Trustapple wrote:

        public static void Main()

        public: It means that this method can be accessed from anywhere.... static: without creating the object of this class we can call the methos directly by using its class name... void: As this main method is a function it should return something so we specifying void which means that it will not return any value... main: it is a function name where the program starts executing...you can call this function from any other functions tooo like.... public void callMain() { main(); }

        Regards, Sandeep Kumar.V

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups