I tried your sample code with my sample inputs. It doesn't give any error or warning.
Normally C will handle this automatic type conversion. ( double to int )
Code:
#include<stdio.h>
#include<math.h>
int* layer2(int* buf,int* bufsize, int flag)
{
if(flag == 1) //Transmit
{
int packetnum = 1;
if(bufsize[0] > 10)
{
double x = (((double)bufsize[0])/10);
packetnum = ceil(x);
printf("packet:%d",packetnum);
}
}
}
int main()
{
int buf[]={1,2,3};
int bufsize[]={25,30,40};
layer2(buf,bufsize,1);
return 0;
}