Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/ecole_etude_fac_de_pau/c/conv.c

(Deskargatu)
#include <stdio.h>
#include <stdlib.h>



void conv(int i )
{
int n;
int tab[8]={0,0,0,0,0,0,0,0};
for (n=0;n<8;n++)
    {
	tab[n] = i % 2;
	i = i /2;
    }
for (n=0;n<8;n++) { printf("%d",tab[7-n]); }
//printf ("\n");
}



int main()
{


float a;
printf("Entrer un float : ");
scanf("%f",&a);
unsigned char* ptr;

ptr = &a;
int i;

for (i=3;i<=0;i--)
{
conv(*(ptr+i));
}

printf("\n");





}