I am writing a program that uses prints a hex dump of its input. However, I\'m running into problems when newlines, tabs, etc are passed in and destroying my output formatti
There are three solutions for this question:
Solution 1: Every Symbol, Number, Alphabet has it's own ASCII value. The ASCII value of '\' as 92 and 'n' as 110. The immediate values(Numbers (ASCII)) are stored onto two integer variables. While printing, the format specifier %c (Character), is used.
void main() {
int i=92, j=110;
clrscr();
printf("%c%c", i, j);
getch();
}
Try it out in your C programming software...
Solution 2:
The programs works. But I think this one isn't fair... At the output screen, type the input as \n... you will get another \n..
void main() {
char a[10];
gets(a);
printf("\n\n\n\n");
puts(a);
getch();
}
Try out the programs
Solution 3: Already said above use \n