I am new to c, & here I am trying to print the values stored in float & double variables in the way they are stored in memory. But compiler is not allowing me to use bitwise operators on float & double variables! I want to know why we can't use bitwise operators like '&' and '|' operators on float & double data types, & what happens if somehow we could use it? Are they any alternative methods or can we bypass such issues?
Here is the code I tried to work on,
int main()
{
float valF = 10;
double valD = 10;
printf("\n\t%i\t%li\n",valI,sizeof(valF));
for(i = 8*sizeof(valF); i >= 0 ; i--)
{
printf("%i",(valF & (1<<i))? 1 : 0);
}
printf("\n\t%i\t%li\n",valD,sizeof(valS));
for(i = 8*sizeof(valD); i >= 0 ; i--)
{
printf("%i",(valD & (1<<i))? 1 : 0);
}
}