Preview

notes on arrays

Satisfactory Essays
Open Document
Open Document
326 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
notes on arrays
DERIVED DATA TYPES:
REFERENCES, ARRAYS AND
POINTERS
Krishna M. Singh
Department of Mechanical and Industrial Engineering
Indian Institute of Technology Roorkee
Roorkee 247667
Reference: Deitel and Deitel. C++ : How to Program.
Prentice Hall, 2008

Krishna M. Singh, Department of Mechanical & Industrial Engineerig, IIT-Roorkee

1

Fundamental Data Types
Basic Types: Boolean, character, integer and floating point types.
Additional Types: void : To signify absence of information void f() // function f() does not return a value void *pv; // pointer to object of unknown type

enumeration (enum): To represent specific set of values. Named integer constants can be defined as members of an enumeration. enum keyword {ASM, AUTO, BREAK}; keyword key;
Krishna M. Singh, Department of Mechanical & Industrial Engineerig, IIT-Roorkee

2

Derived Data Types
Address Types
References
Pointers
Powerful, but difficult to master
Simulate pass-by-reference
Close relationship with arrays and strings

Aggregate Types
Arrays and strings
Structures and Unions
Abstract Data Types (ADTs): classes
Krishna M. Singh, Department of Mechanical & Industrial Engineerig, IIT-Roorkee

3

References
Reference is another name (alias) for a variable
It is a pointer but a constant one – once declared it cannot be made alias of another variable
A reference declaration must have initialization and it can be initialized to a variable, not a literal constant. A variable can have several references (aliases) – all references hold the same address
Reference is not a separate variable like a pointer
– it does not occupy space in memory
Krishna M. Singh, Department of Mechanical & Industrial Engineerig, IIT-Roorkee

4

…. References
All operations supposedly performed on the alias (i.e., the reference) are actually performed on the original variable Example int count = 1; int &cRef = count; cRef++; Increments count through alias cRef

You May Also Find These Documents Helpful

  • Good Essays

    Arrays store items that have the same type of data type like a group of employees’ names and social security numbers for a team of 2000 personal. Pointer is a variable that greatly extends the power and flexibility of a program, each memory location that is used to store data value has an address. The address provides the means for a PC hardware to reference a particular data item.…

    • 485 Words
    • 2 Pages
    Good Essays
  • Better Essays

    The Declaration and Address’ intended audience was all who love our Lord Jesus Christ. The intended audience ties in with the message of most of the document in that it speaks of unity. A major part of the Stone-Campbell Movement was to bring unity and the Stone-Campbell Movement was formed through unity. I think a couple of the main reasons why unity is so important in the document was one, because God calls us to unity through Him, and two, because the Stone-Campbell Movement was created through unity. If Stone and Campbell stayed separate in their thoughts, beliefs, and motives the impact they were able to have would not have happened. The importance of unity is far beyond describing. When there is not unity in the Church, then the Church will fall. Division makes anything weak. That is why the topic of unity is discussed with such importance.…

    • 861 Words
    • 4 Pages
    Better Essays
  • Good Essays

    Week 2 Math221 Notes

    • 397 Words
    • 2 Pages

    Feedback: A primary characteristic of the correlation concept is that it only describes the fact that a linear relationship exists. The determination of cause and effect requires more study and analysis. That is not to say that a cause-and-effect relationship won't exist. It only says that it cannot be determined by the correlation.…

    • 397 Words
    • 2 Pages
    Good Essays
  • Good Essays

    According to Atkinson and Shiffrin the multi-store memory has 3 distinctive stores; sensory registry, short term memory (STM) and long term memory (LTM). Information from the environment enters the sensory memory for 0.5 second, if the individual is paying attention this information will enter the STM, from there if the information is rehearsed it will be store into the LTM. Duration is how long the memory lasts, capacity is how much memory an individual can store, encoding is what format it is stores in for example some are stored by sounds, this called acoustic. Some people remember semantically because they associate information with the meaning as information is well remembered if it is better understood.…

    • 570 Words
    • 3 Pages
    Good Essays
  • Good Essays

    The way we communicate with each other drives how our lives are going to be. With every day that goes by we communicate with our families, friends, and co-workers. Our relationships with those that we communicate with can determine how we choose to communicate with them. Meeting a stranger on the street and saying hi, or asking for directions draws upon a more simple skill set of communication than speaking to a familiar co-worker or spouse. Having a close relationship to someone can change how we communicate with them and lead to poor communication.…

    • 881 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Analysis Paper

    • 1037 Words
    • 5 Pages

    Have you ever been driving down the road and have something bad happen to you that you have to slam on the breaks? If you have, then maybe you can relate to the following commercial. Even if you have never had this happen to you, you still might be able to relate to it. The basic idea of the commercial is that no matter what happens in life, that you should always be prepared for what to do next.…

    • 1037 Words
    • 5 Pages
    Good Essays
  • Good Essays

    7 and Array

    • 500 Words
    • 2 Pages

    7. When a single array element, such as myArray[2], is passed to a method, the method receives _____.…

    • 500 Words
    • 2 Pages
    Good Essays
  • Good Essays

    The multi- store model of memory is an explanation to how memory processes work, we hear, see and feel many things but only a small number are remembered, the model was first introduced by Atkinson and Shiffrin in (1968), whereby they explained tat the multi-store model of memory has 3 stages which is sensory memory, short-term memory and long-term memory, this information processing approach to Cognitive Psychology, describes the mental functions which occur between stimulus and response, it is based upon the model of the mind as a computer.…

    • 863 Words
    • 4 Pages
    Good Essays
  • Good Essays

    The multi-store model of memory (MSM) is an explanation of the process of memory. Richard Atkinson and Richard Shiffrin first illustrated the multi-store model, in 1968, it explains how we hear, see and feel many things but only a small number are remembered and other aren’t.…

    • 953 Words
    • 4 Pages
    Good Essays
  • Powerful Essays

    “The Persistence of Memory,” by Salvador Dali, “A Trip to the Moon,” by George Méliès, and “The Great Day of His Wrath” by John Martin…

    • 1949 Words
    • 8 Pages
    Powerful Essays
  • Good Essays

    Prg 211 Array Structure

    • 788 Words
    • 4 Pages

    During the development of the Naming Scheme program for the Quality Review Measurement staff, additional naming schemes were discussed for future revisions to the program. The current program only allows the inputs that relate to the file names for the Conference Call notes. There are additional files not related to the conference calls that will benefit from the use of a naming scheme. For consideration, the following file groups will be added in the next revision of the Naming Scheme: Monthly Executive Report, Quarterly Executive Report, Annual Executive Report, and the EQRS Monthly Analysis (per Product Line).…

    • 788 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    unit 4

    • 691 Words
    • 4 Pages

    A variable is declared inside a local module in which it is the only statement within a module…

    • 691 Words
    • 4 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Soc203 Lecture 1

    • 511 Words
    • 3 Pages

    - social fact: e.g. Durkheim & suicide rates; constancy means that there is something about society…

    • 511 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Analysis Paper

    • 1275 Words
    • 6 Pages

    In Richard Connell's "The Most Dangerous Game," a story is told about survival and human nature. In it, basic themes are presented, and basic questions are asked. Our hero must answer some of these questions as he finds himself in a quest for survival using only his skills. At the end, the reader will be left wondering his own answer to these questions. In his story, Richard Connell explores the basic human need to survive and what can happen when power remains unlimited.…

    • 1275 Words
    • 6 Pages
    Good Essays
  • Powerful Essays

    Analysis Paper

    • 2066 Words
    • 9 Pages

    On June 2012, Jerry Sandusky, former assistant Penn State football coach, was found guilty for 45 of the 48 charges of sexual abuse of young boys over a 15 year period. He was previously known as a notable college football coach who wrote several books and even founded The Second Mile, a nonprofit charity serving Pennsylvania underprivileged and at risk youth. This scandal deeply affected the whole Penn State community but also the entire state of Pennsylvania, victims and their families, and the general public. It was a media frenzy and many were shocked to hear about the corruption that was going on at Penn State. One of the greatest football organizations in the country was slowly collapsing more and more each day. Cover up’s facilitated by Joe Paterno (Penn States head football coach), Graham Spanier (President of the Penn State), Gary Schultz (Penn State Vice President) and Tim Curley (Penn State Athletic Director) was shocking to uncover. Overall the scandal revealed many ethical problems going on at Penn State that effected many people directly and indirectly which is extremely hard to swallow.…

    • 2066 Words
    • 9 Pages
    Powerful Essays