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

  • SEARCH
  • Home
  • 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 6996427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:09:17+00:00 2026-05-27T20:09:17+00:00

I tried the following code #include <stdio.h> int main(void) { typedef static int sint;

  • 0

I tried the following code

#include <stdio.h>

int main(void)
{
    typedef static int sint;
    sint i = 10;

    return 0;
}

and hit the following error:

error: multiple storage classes in declaration specifiers

When I referred the C99 specification, I came to know that typedef is a storage class.

6.7.1 Storage-class specifiers

Syntax

storage-class-specifier:
    typedef
    extern
    static
    auto
    register

Constraints: At most, one storage-class specifier may be 
             given in the declaration specifiers in a declaration

Semantics: The typedef specifier is called a ‘‘storage-class specifier’’ 
           for syntactic convenience only; 

The only explanation that I could find (based on some internet search and cross referring various sections in C99 specification) was syntactic convenience only to make the grammar simpler.

I’m looking for some justification/explanation on how can a type name have storage class specifier?

Doesn’t it make sense to have a code like typedef static int sint;?

or Where am I going wrong?!

  • 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-05-27T20:09:18+00:00Added an answer on May 27, 2026 at 8:09 pm

    Yes, typedef is a storage-class-specifier as you found in the standard. In part it’s a grammatical convenience, but it is deliberate that you can either have typedef or one of the more “obvious” storage class specifiers.

    A typedef declaration creates an alias for a type.

    In a declaration static int x; the type of x is int. static has nothing to do with the type.

    (Consider that if you take the address of x, &x has type int*. int *y = &x; would be legal as would static int *z = &x but this latter static affects the storage class of z and is independent of the storage class of x.)

    If something like this were allowed the static would have no effect as no object is being declared. The type being aliased is just int.

    typedef static int sint;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Tried the following code : #include<stdio.h> int main() { int *p,*q; p = (int
Running the following code on Windows 7 x64 #include <stdio.h> #include <errno.h> int main()
The following code: #include <stdio.h> typedef union { int n; char *s; } val_t;
I have the following code: #include <stdio.h> template<int A> class Thing { // 5
I tried compiling the following code in Linux and VS 2008: #include <iostream> //
I tried the following code in LINQPad and got the results given below: List<string>
I tried the following code to get an alert upon closing a browser window:
I tried the following code. Although I don't get any errors, it did not
I have tried the following code but has no effect: Imports system.Runtime.InteropServices <DllImport(UxTheme.DLL, BestFitMapping:=False,
I'm looking for the Go equivalent of scanf(). I tried with following code: 1

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.