Thread: Why can't we use two storage specifier in front of variable

  1. #1
    Registered User
    Join Date
    Nov 2019
    Posts
    90

    Why can't we use two storage specifier in front of variable

    Hi

    Why can't we use two storage specifier in front of variable

    Code:
    #include <stdio.h>       
    int main() 
    { 
        static register int i = 20;
    	
    	printf("\n %d", i));
    	
        return 0; 
    }

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    It might be helpful to think of the opposite as a thought experiment: what if we could specify two storage classes for a variable? What would auto extern mean?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Nov 2019
    Posts
    90
    Quote Originally Posted by laserlight View Post
    It might be helpful to think of the opposite as a thought experiment: what if we could specify two storage classes for a variable? What would auto extern mean?
    I just need to remember that we can't do this

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 11-18-2019, 04:03 PM
  2. Replies: 2
    Last Post: 02-27-2013, 07:52 AM
  3. expected specifier-qualifier-list before [variable]
    By Elixz in forum C Programming
    Replies: 19
    Last Post: 05-25-2012, 03:44 PM
  4. storage class specifier
    By -EquinoX- in forum C Programming
    Replies: 5
    Last Post: 11-06-2008, 04:07 PM
  5. Replies: 3
    Last Post: 07-08-2008, 10:01 AM

Tags for this Thread