Logo/

Flashcards on Pointers in Basic Programming

Log in

Made with ScholarlyMake flashcards like these from your own notes

Flashcards on Pointers in Basic Programming

Questions and answers

11 cards
  1. Question:What is a pointer?

    Answer:A variable that contains the memory address of another variable

  2. Question:What is the address of a variable?

    Answer:The specific location where a variable is stored in memory

  3. Question:What is the contents of a variable pointed by the pointer?

    Answer:The value stored in the memory location that the pointer is pointing to

  4. Question:What is the syntax for pointer declaration?

    Answer:Type * pointer name;

  5. Question:What is the syntax for pointer initialization?

    Answer:Type* pointer_name = &variable_name;, Type* pointer_name = NULL;

  6. Question:How do you access a value through a pointer?

    Answer:Using the * operator

  7. Question:How do you pass pointers to functions?

    Answer:Declare function parameters as pointer type

  8. Question:How do you return pointers from functions?

    Answer:Declare function return type as a pointer type

  9. Question:What are void pointers?

    Answer:Pointers that can point to other variables of any type

  10. Question:What are pointers to constants?

    Answer:Pointers that point to a value that must not be changed

  11. Question:What are constant pointers?

    Answer:Pointers whose address stored in the pointer cannot be changed, but the value pointed by the constant pointer can be changed