raghu wrote:
int main(void)
{
char ch[20];
printf("enter the text");
scanf("%s",ch);
printf("the binary equivalent of the text is\n");
//here what should be the statement to convert it into binary
}
Ex: if i give the text as : google welcomes
I shud get binary equivalent of each letter as output
Hope this time i'm very clear....
Sorry for the inconvenience...
Please quote the post to which you're replying. Not all readers of
Usenet can have easy or permanent access to previous posts and without
context, your reply makes little sense. If you're using Google Groups
then read the following URLs for more information on how to do it.
<http://cfaj.freeshell.org/google/>
<http://www.safalra.com/special/googlegroupsreply/>
<http://clc-wiki.net/wiki/Introduction_to_comp.lang.c>
<http://en.wikipedia.org/wiki/USENET>
Coming to your question, as I mentioned in my other post in this
thread, you'll need to write a function to assemble a base two based
string representation of your input, character at a time. Such a
function is a trivially easy task.
Using CHAR_BIT declared in <limits.hyou can extract each nibble in
the input character and use it as an offset into a lookup table to
extract the binary string equivalent, which will be four bytes long.
You can concactenate these pieces and display the final result to your
output.
Have a go at an attempt and if you don't get it right, post the code
here for further comments.