-
noob help
Hi, I'm using Dev-C++ and according to the book I'm reading the following code should display:
ch1 = H and ch2 = A
Code:
#include <stdio.h>
main()
{
int ch1,
ch2 = `A´;
ch1 = ch2+7;
printf("\nch1 = %c and ch2= %c\n", ch1, ch2);
fflush(stdin);
getchar();
}
The problem is that the program doesn't accept the `A´ part, it is Dev-C++ or am i doing something wrong, it's probably something simple but I'm new at this...
Thanks!
-
Its 'A' not `A` or whatever you wrote...
-
-
Thanks! now it works.
But my book does say `A´ (C for business programming, John C. Molluzzo)
-
Different fonts. Some word-processor type programs use "smart" quotes. They don't mix well with code.
-
> fflush(stdin);
If your book tells you to do this, you need a different book.
See the FAQ - flushing input streams is undefined.
- your input stream is flushed.
- my input stream is unchanged.
- her hard disk is reformatted.