EmbLogic's Blog

int arr[256]={0};
int c;
while((c=getchar())!=’\n’)
arr[c]=1;
printf(“%c \n”,c);
//printable characters
for(c=32;c<127;c++)
{
if(arr[c])
putchar(c);
}
i have made this but not able to understand this code what’s happeninf actually

2 Responses to

  1. abhishek says:

    Its a sorting prog for printable characters(in the range of 32 to 127).
    Test input: enter a,b,c,d,e in any sequence.
    the output will always be the sorted one.

  2. abhishek says:

    32 to 127 are the int or the ascii value of the char

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>