/* the code fragment below is real one...done all by myself..*/
Code:
main()
{
int len,i;
char a[]="abcdefg";
len=strlen(a);
for(i=0; i<len; i++)
printf("%2d ",a[i]);
}
the above code outputs decimal values, of the given string as:-(97 98 99..)
--
/* this code below is a stolen one */
Code:
void bit(int);
main()
{
int val=15;
printf("bitpattern is:");
bit(val);
}
void bit(int n)
{
int m,i;
for(i=15; i>=0; i--)
{
m=1<<i;
if((n&m)==0)
{
printf("0");
}
else
{
printf("1");
}
}
}
here it gives the bit patterns of a given decimal say 15, as (00001111).
--
how do i combine these two functionalities..to get the bit pattern of a given string..?
thank you..!