Some books claim that they used ansi c and use turbo c compiler to run these example. i tried to run these on linux but I found that these example are only for windows.
#include<stdio.h>
#include<conio.h>
/* #include<dos.h> */
int main()
{
int a;
clrscr();
scanf("%d", &a);
printf("%d",a);
getch();
return 0;
}
Can I call the above example ansi c? why or why not?
As @milevyo said, those functions are implemented by Borland's compilers. On Windows you can replace clrscr()
with system("cls")
and getch();
with _getch();
or, even better, getchar()
.