top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Can we use storage class specifier for the function arguments or if there is a default storage for the same ?

+2 votes
503 views
Can we use storage class specifier for the function arguments or if there is a default storage for the same ?
posted Jan 23, 2015 by Chirag Jain

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
I wrote and tested for integer values It works but for decimal values if was not working.

1 Answer

0 votes

Yes, of course we can use storage class specifier for the function.
By default function has an EXTERN storage class.

answer Jan 27, 2015 by Chirag Gangdev
For function we can use them but the question is, if we can use them for the function 'arguments' or not.
As far as i know, we can not specify storage class for the function argument.
by default the storage class of function argument is REGISTER.
Similar Questions
+1 vote

I have written a simple program and stored it with .c file,
When i compiled it with g++ it is getting compiled and giving the proper output when i run that,
but when i compile the same using gcc then it is throwing error.

Below is the sample .c file
#include<stdio.h>
struct A{
        private:
        int a;
        public:
        int sum(){
        a=10;
        }
        void print()
        {
        printf("%d\n",a);
        }
        A()
        {
                printf("Constructor\n");
        }
        A(int b)
        {
                printf("Copy Constructor\n");
        }
        ~A()
        {
                printf("Destructor\n");
        }
};
main()
{
        struct A a(10);
        a.sum();
        a.print();
}
...