CSE271: Short Quiz #4 -- C Pointers

  1. Your name, today's date (2 points)
  2. Is there anything wrong with this code? If so, what is it? (2 points)
       #include <string.h>
    
       char string1[] = "Hello, world!";
       char *string2;
    
       strcpy(string2, string1);
    
  3. At the end of this code, what is the value of i? (2 points)
       int i = 4;
       int *p1, *p2;
    
       p1 = &i;
       p2 = p1 - 1;
    
       i++;
       i = *p1;
    
  4. What is the name of the library call that returns memory to the operating system that had originally been allocated using malloc()? (2 points)
    
    
    
  5. What is a null pointer? (2 points)

Last revised: 8 February 2007, Brian D. Davison.