Software and Applications (non-game)
Computer Programming
C Programming

Do you specify a storage class with typedef?

383940

Top Answer
User Avatar
Wiki User
Answered
2007-12-13 10:19:08
2007-12-13 10:19:08

In C, "typedef" is a storage class, but sort of a weird one. It specifies that you are not actually creating an object, but merely defining a type. As such, there is nothing to be stored (at runtime). The other storage classes, auto, extern, register, and static, all specify actual storage.

001
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0

Related Questions


They is static, auto, extern and typedef. (Well, typedef aint't an actual storage class, it means type-definition.)

Different from what? Storage classes are auto, register, static, extern and typedef (formally).

auto, extern, static, register, typedef (only formally)

one of these: static, extern, auto, register, typedef (just formally!)

The storage class specifiers in C and C++ are:autoexternmutableregisterstatictypedefA storage class specifier is used to refine the declaration of a variable, a function, and parameters

create class with typedef construct.and then add the base class with the name type

AnswerA typedef declaration lets you define your own identifiers that can be used in place of type specifiers such as int, float, and double. A typedef declaration does not reserve storage. The names you define using typedef are not new data types, but synonyms for the data types or combinations of data types they represent. The name space for a typedef name is the same as other identifiers. The exception to this rule is if the typedef name specifies a variably modified type. In this case, it has block scope.When an object is defined using a typedef identifier, the properties of the defined object are exactly the same as if the object were defined by explicitly listing the data type associated with the identifier.Examples of typedef DeclarationsThe following statements declare LENGTH as a synonym for int and then use this typedef to declare length, width, and height as integer variables:typedef int LENGTH;LENGTH length, width, height;The following declarations are equivalent to the above declaration:int length, width, height;Similarly, typedef can be used to define a class type (structure, union, or C++ class). For example:typedef struct { int scruples;int drams;int grains;} WEIGHT;The structure WEIGHT can then be used in the following declarations:WEIGHT chicken, cow, horse, whale;In the following example, the type of yds is "pointer to function with no parameter specified, returning int".typedef int SCROLL();extern SCROLL *yds;In the following typedefs, the token struct is part of the type name: the type of ex1 is struct a; the type of ex2 is struct b.typedef struct a { char x; } ex1, *ptr1;typedef struct b { char x; } ex2, *ptr2;Type ex1 is compatible with the type struct a and the type of the object pointed to by ptr1. Type ex1 is not compatible with char, ex2, or struct b.C++ The remainder of this section pertains to C++ only.In C++, a typedef name must be different from any class type name declared within the same scope. If the typedef name is the same as a class type name, it can only be so if that typedef is a synonym of the class name. This condition is not the same as in C. The following can be found in standard C headers:typedef class C { /* data and behavior */ } C;A C++ class defined in a typedef without being named is given a dummy name and the typedef name for linkage. Such a class cannot have constructors or destructors. For example:typedef class { Trees(); } Trees;Here the function Trees() is an ordinary member function of a class whose type name is unspecified. In the above example, Trees is an alias for the unnamed class, not the class type name itself, so Trees() cannot be a constructor for that class.External Links:You can find more questions with answers for C typedef from http:/www.indiabix.com/c-programming/question-answer.php?topic=nqvoiusqthttp:/www.indiabix.com/c-programming/index.php

Storage classes are auto, register, static, extern and typedef (formally only).

Basically storage class defines the accessibity of a variable. If you specify a variable with auto storage class, then that variable can be accessed only in that function or block where it is declared. if you specify a variable with static storage class, it has the same visibily like an auto variable but it can retains it's value between function calls where as an auto variable cannot. look at this example: void main() { int i,j ; for(j = 0; j< =2; j++) { i = fun1(); printf("%d",i); } } int fun1() { static int k =0; k = k+1; return k; } it prints 1 2 3

static, extern, auto, register (and typedef, but only formally)

You can use every standard C modifier in TurboC: long, short, signed, unsigned; and every storage class as well: static, extern, auto, register, typedef.

There are four types of storage class or variable in c. 1) auto storage class. 2) register storage class. 3) static storage class. 4) external storage class.

the storage class is define as 10th class and 9th class and the examples are 10b and 9a

Extern is not storage class.

the differente storage classices is auto,extern,register,and static storage class

A typedef is a type definition.

Nothing, random value, unless you initialize the variable explicitly.Note: 'register' is not a storage class, it's only a modifier for 'auto' storage class.

No, but 'typedef int a;' is possible, it defines the type 'a'.

the purpose of typedef is to redefine the name of an existing variable type. e.g. typedef unsigned long int T; T v1,v2;

typedef data_type data_name, for instance:typedef int myDataType;

typedef is used to create user defined data types

storage classes is important part of c language.WHENEVER we define any function in c program then we can call that in every definend class. there are four types of storage class. these are... 1 AUTO OR AUTOMATIC STORAGE CLASS 2 REGISTER STORAGE CLASS 3 STATIC STORAGE CLASS 4 EXTERNALSTORAGE CLASS 1) The features of "AUTOMETIC" storage class are as under some conditions: storage : storage will be in memory. value : garbage value. scope : scope is local to block to the variable. life : till, controls remain within the block. 2) The featurs of "STATIC" storage class are as under some conditions: storage : memory. value : zero. scope : local to block. life : Till control remains within the block. 3) The featurs of "REGISTER" storage class are as under some conditions: storage : register. value : garbage value. scope : local to the block. life : value persists between variable. 4) The feature of "EXTERNAL" storage class are as under some conditions: storage : memory. value : zero. scope : local to block. life : till controls remains within the block.

inline itself should be considered as a storage class


Copyright ยฉ 2020 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.