title: Stored UIImage pixel data into c array, unable to determine array's element count
body: <p>I initialized the array like so</p>
  
  <pre><code>CGImageRef imageRef = CGImageCreateWithImageInRect(image.CGImage, bounds);
  CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
  NSUInteger width = CGImageGetWidth(imageRef);
  NSUInteger height = CGImageGetHeight(imageRef);
  unsigned char *rawData = malloc(height * width * 4);
  NSUInteger bytesPerPixel = 4;
  NSUInteger bytesPerRow = bytesPerPixel * width;
  NSUInteger bitsPerComponent = 8;
  CGContextRef context = CGBitmapContextCreate(rawData, width, height, bitsPerComponent, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
  </code></pre>
  
  <p>However, when I tried checking the count through an NSLog, I always get 4 (4/1, specifically).</p>
  
  <pre><code>int count = sizeof(rawData)/sizeof(rawData[0]);
  NSLog(@"%d", count);
  </code></pre>
  
  <p>Yet when I NSLog the value of individual elements, it returns non zero values.</p>
  
  <p>ex.<br>
       <code>CGFloat f1 = rawData[15];</code></p>
  
  <p><code>CGFloat f2 = rawData[n]</code>, where <code>n</code> is <code>image width*height*4</code>; </p>
  
  <p>//I wasn't expecting this to work since the last element should be n-1</p>
  
  <p>Finally, I tried </p>
  
  <pre><code>int n = lipBorder.size.width *lipBorder.size.height*4*2; //lipBorder holds the image's dimensions, I tried multiplying by 2 because there are 2 pixels for every CGPoint in retina
  CGFloat f = rawData[n];
  </code></pre>
  
  <p>This would return different values each time for the same image, (ex. 0.000, 115.000, 38.000).</p>
  
  <p>How do I determine the count / how are the values being stored into the array?</p>