Handout-9 CSM-1101.doc - ALIGARH MUSLIM UNIVERSITY...

Info icon This preview shows pages 1–3. Sign up to view the full content.

ALIGARH MUSLIM UNIVERSITY Department of Computer Science Course: MCA CSM-1101: Problem Solving Using C++ Academic Session 2017-2018 Handout-9 Topic: Storage class specifiers Teacher : Dr. Rafiqul Zaman Khan, Professor +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Objectives: To learn about storage class specifiers in C++.. Storage-Class Specifiers : The C++ storage-class specifiers tell the compiler the duration and visibility of the object or function they declares, as well as where an object should be stored. The following are storage class specifiers: auto register static extern auto Keyword The auto storage-class specifier declares an automatic variable, a variable with a local lifetime. It is the default storage-class specifier for block-scoped variable declarations. auto declarator ; // auto_keyword.cpp int main() { auto int i = 0; // Explicitly declared as auto. int j = 0; // Implicitly auto. } register Keyword 1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

The register keyword specifies that the variable is to be stored in a machine register, if possible. A register declaration ia an auto declaration. A register variable has all the characteristics of an auto variable> The only difference between the two is that register variable provide fast access as they are stored inside CPU registers rather than in memory. So, the time required to read from memory is saved. The register as well as auto can be applied only to local variables.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern