C++ storage class


  Translation results:

C++ is a statically typed, compiled, general-purpose, case-sensitive, irregular programming language that supports procedural programming, object-oriented programming and generic programming.

C++ is considered a mid-level language that combines the features of high-level and low-level languages.

C++ was designed and developed by Bjarne Stroustrup in 1979 at Bell Laboratories in Murray Hill, New Jersey. C++ further extended and improved the C language, originally named C with classes and later renamed C++ in 1983.

C++ is a superset of C. In fact, any legal C program is a legal C++ program.

C++ storage classsyntax

Storage classes define the scope (visibility) and lifetime of variables/functions in a C++ program. These specifiers are placed before the type they modify. The storage classes available in C++ programs are listed below:

auto

register

static

extern

mutable

thread_local (C++11)

Starting with C++ 11, the auto keyword is no longer a C++ storage class specifier, and the register keyword is deprecated.

C++ storage classexample

auto f=3.14; //double
auto s("hello"); //const char*
auto z = new auto(9); // int*
auto x1 = 5, x2 = 5.0, x3='r';//Error, must be initialized to the same type

Home

Videos

Q&A