## Bitmaps mainipulation

My Question:
In the following code would just type casting to float be alright?Note that newblue,newgreen and newred are float.The output after this manipulation is not what is desired...the size which we shrink it to is correct but not the image content.I am trying to shrink the image to half its size.My height and width are 1/2 and my size is 1/4 the area.but I wish to change the pixels ina way that 4 pixels avereaged to 1 by converting the values floating point and then average them to nearest int.

Code:
```	 myrow=i/(oldwidth);
mycolumn=i%(oldwidth);
for(i=0;i<(oldheight*oldwidth);i+=4)
{

newblue=((float)*(blue+i)+ (float)*(blue+(i+1))+ (float)*(blue+(i+2))+ (float)*(blue+i+3))/4;
*(blue+i)=(int)newblue;

newgreen=((float)*(green+i)+ (float)*(green+(i+1))+ (float)*(green+(i+2))+ (float)*(green+i+3))/4;
*(green+i)=(int)newgreen;

newred=((float)*(red+i)+(float) *(red+(i+1))+ (float)*(red+(i+2))+(float) *(red+i+3))/4;
*(red+i)=(int)newred;

//	if(myrow%2==0 || mycolumn%2==0 )
//  {
putchar(*(blue+i));
putchar(*(green+i));
putchar(*(red+i));

//  }
}*/```