Use of void data type

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • upadhyay15deep
    New Member
    • Oct 2007
    • 2

    Use of void data type

    hi sonia, i m deepak doing mca from j.s.s noida.

    i need ur help in c .
    if u r interested then plz rply me the use of void data type.

    is it used only in functions return type or it can be used as a data type as well .
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Hi deepak

    Welcome to TSDN.

    Feel free to post questions in the related forum only by choosing from under the blue bar on the top of your page.

    But before that give a try from your side and if possible try to post what/how you have approached to solve the problem.

    It will help Experts in the forum in solving / underestanding your problem in a better way.

    Please follow the posting guidelines in every new post/reply.

    Please specify your post/question clearly.Please use proper code tags in all your codes.

    Regards

    Debasis

    Comment

    • numberwhun
      Recognized Expert Moderator Specialist
      • May 2007
      • 3467

      #3
      Originally posted by upadhyay15deep
      hi sonia, i m deepak doing mca from j.s.s noida.

      i need ur help in c .
      if u r interested then plz rply me the use of void data type.

      is it used only in functions return type or it can be used as a data type as well .
      You have posted a "c" question to the Member Introductions forum. I will move this to the "c" forum where it belongs in order to obtain an answer to your question.

      In the future, please post your questions in the forum most closely related to the topic.

      Regards,

      Moderator

      Comment

      • sicarie
        Recognized Expert Specialist
        • Nov 2006
        • 4677

        #4
        Originally posted by upadhyay15deep
        is it used only in functions return type or it can be used as a data type as well .
        Well, the easiest way to try this out is to create a program you know is legal

        [code=cpp]
        int main()
        {
        int testVar;
        cout << "Test var: " << testVar;

        return 0;
        }
        [/code]

        change the type, and then compile it. Try that and see what it gives you.

        Note: I did not initialize testVar, so you will get a "garbage variable" when you run this with it as an int.

        Comment

        Working...