thank you for your reply,
i am trying to do the same
Code:
char ss[1000];
char ss_ptr = (char *)((((int)ss)+(7)) & ~7);
what i am trying to do is i want to create stack with all the arguments,
with memcpy it is not possible to align to the memory thats why i want to use only va_arg, but it should replace memcpy and should copy anytype of data into ss.
i am trying to write like this
Code:
int tmp_val;
char *tmp_val1;
//for int
case 0: tmp_val = va_arg(vlist,int);
//memcpy(&ss[ss_cnt], &tmp_val, sizeof(int));
ss_ptr=(char *)tmp_val;
printf("\n int ss[ss_cnt]=%d",ss_ptr);//which is printing the right value
//for float
case 1:tmp_val1 = va_arg(vlist,float);
//memcpy(&ss[ss_cnt], &tmp_val1, sizeof(float));
ss_ptr=(char *)&tmp_val1;
printf("float val=%f\n", ........_ptr);// iam not getting the right value
as float directly cannot given to char * i thought of assigning its address to char *
and get the value from that address but not working how to solve this any inputs will be great.