Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8159135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:49:01+00:00 2026-06-06T17:49:01+00:00

What does putting void; on a line do in C? The compiler is warning

  • 0

What does putting void; on a line do in C? The compiler is warning about it but i dont understand. What is the point in being able to put void on a line like this?

#include <stdio.h>

int main() {
        void;
        printf("word dude");
        return 1;
}

eh

$ gcc -pedantic -ansi -Wall -Wextra eh.c -o eh
eh.c: In function 'main':
eh.c:4:2: warning: useless type name in empty declaration
$ ./eh
word dude

People seem to be getting confused what I’m asking: What does this line mean, does it do anything? why is it valid?

void;

Removed void cast as it’s causing unnecessary discussion.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:49:02+00:00Added an answer on June 6, 2026 at 5:49 pm

    This question got me interested because my first thought was K&R. I went back to my old K&R book (Appendix A p.192) on found blurb about declarations (transcripted):

    8. Declarations
    
    Declarations are used to specify the interpretation which C gives to each identifier; they do not necessarily reserve storage associated with the identifier. Declarations have
    the form
        declaration:
            decl-specifier declarator-listopt;
    
    The declarators in the declarator-list contain the identifiers being declared. The decl-specifiers consist of a sequence of type and storage class specifiers.
        decl-specifiers:
            type-specifier decl-specifiersopt
            sc-specifier decl-specifiersopt
    

    This leads me to believe that delarator lists are optional (meaning it can be empty).

    To add to this confusion on following page, it lists the set of legal type-specifier values and void is not one of them.

    In my narrow interpretation that this may be still legal (but obsolete) C.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Quick question! Does putting a clear element INSIDE a floated div do anything? Like:
what does putting () after a word do? sometimes it doesn't work
What exactly does putting extern C into C++ code do? For example: extern C
I'm hoping someone here can answer these definitively: Does putting a VHD file in
Does anybody know how I can theme the ctools modal window? I've tried putting
I asked about this before, but, I decided to start a new thread with
Does anyone know if putting too many OpenGL calls into a displaylist can cause
It has methods like CRichEditCtrl::Copy() , CRichEditCtrl::Paste() which you can call, but I can't
Does anyone have an idea about how to get rid of flickering? I researched
I (like many others) followed the webview tutorial, but I can't get pages to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.