6202019.docx - Pointer(pointer variable-a memory cell that stores the address of a data item-syntax type variable Int m = 25 Int itemp a pointer to an

6202019.docx - Pointer(pointer variable-a memory cell that...

This preview shows page 1 - 5 out of 5 pages.

Pointer (pointer variable) -a memory cell that stores the address of a data item -syntax: type * variable Int m = 25; Int* itemp; /* a pointer to an integer */ Itemp = &m; //itemp contains address of v Dcreferencing (value to which itemp points) *itemp = m; Printf(“%d”, *itemp);
Image of page 1

Subscribe to view the full document.

Indirection -indirect reference -accessing the contents of a memory cell through a pointer variable that stores it address Pointer or pointer variable a memory cell that stores the address of a data form Int *itemptr; //a pointer to an integer Means we can store the memory address of type int in variable itemptr Int num = 25; Itemptr = # //stores address of num in pointer itemptr num = 71; printf(“%d”, *itemptr); temp = c; //put value of c in temp c = d; //put value of d in c d = tmp; //put the original vale of c in d void swapping(int c, int d); int main() {
Image of page 2
Int a = 3, b = 7; Printf(“input to function swapping: %d and %d\n”, a, b);
Image of page 3

Subscribe to view the full document.

Image of page 4
Image of page 5
  • Spring '10
  • TAMIWSORGENTE
  • Pointer

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

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes