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
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
EmbLogic Research & Competency Development Labs
Phone: +91 9818467776, 8527567776, 9650467776
Email: info@emblogic.com
Copyright © EmbLogic Embedded Technologies Pvt. Ltd.
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.
32 to 127 are the int or the ascii value of the char