The following code works fine
#define open {
#define close }
#include<stdio.h>
#define int char
main()
open
int a ;
printf("This is testing code" );
close
But If I exchange the lines
#include<stdio.h>
#define int char
as
#define int char
#include<stdio.h>
it throws lot of errors like this
In file included from /usr/include/stdio.h:36,
from print.c:19:
/usr/include/bits/types.h:35: error: both 'short' and 'char' in declaration specifiers
/usr/include/bits/types.h:37: error: both 'long' and 'char' in declaration specifiers
/usr/include/bits/types.h:42: error: both 'short' and 'char' in declaration specifiers
/usr/include/bits/types.h:43: error: both 'short' and 'char' in declaration specifiers
.................................................
so and so
Actually what is happening inside stdio.h ?
There are defined variables of type short int, long int and so on, which obviously fails when you change them through define to short char and long char.
Redefining basic C types is usually not a good idea.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With