K
kevin
write a program in c.
write a program in c.
kevin said:write a program in c.
kevin said:write a program in c.
kevin said:write a program in c.
Save the program below in a file called test.c. Invoke your favourite
compiler and enjoy.
#include "test.c"
main(){}
Walter said:Is this for C89 or C99? If it is for C99 then you need the 'int'
on main. If it is for C89 then you should return a value from main.
Recall, by the way, that compilers are permitted to impose limits on
the depth of inclusions. For example,
gcc version 3.4.4 20050721 (Red Hat 3.4.4-2)
with default options will expand to a total of 199 instances of main.
kevin said:write a program in c.
John said:kevin said:write a program in c.
Easy.
/*
* aprog.c
*
* "write a program in c."
*
*/
#include <stdio.h>
#define in "\n"
#define c
int write(const char *foo)
{
signed int short bar = 0;
const char *baz = foo;
while(baz[bar]) putchar(bar[baz++]);
return 0;
}
int main(void)
{
return write("a program" in c);
}
This program works not with LCC-WIN32 again! Why?
lc -ansic -pedantic -unused shadows -O aprog.c
Pedants aren't supported any more
1 error
How do you do that? Not funny!
kevin said:write a program in c.
Jens said:Jacob Navia announced in a recent thread here in clc
http://groups.google.com/group/comp...7bd9720d78/7a4bcdc84d952874?q=Pedants&lnk=ol&
that lcc-win no will longer have a '-pedantic' option (or, to be
precise, will output the above text if it's used). Since it's his
compiler he can do whatever he likes with it.
Hans Schneider said:But, if I remove -pedantic, it works still not:
lc -ansic -unused -shadows -O aprog.c
Error aprog.c: 14 invalid type specification
1 error, 0 warnings
1 error
Is signed int short bar = 0; valid C?
Keith said:Ok, done.
If you're interested, the output was:
Qb lbhe bja ubzrjbex
Kenneth said:Done. What do I get?
kevin said:Looks like rot13. How do you decode that in C?
kevin said:Cool. Can I see it?
Richard said:kevin said:
By writing a rot13-decoder. Once you've achieved this, writing a
rot13-*en*coder is relatively simple.
kevin said:Yes I know, I won first price in a rot13 contest. It is easy to do in
your head because for example 'D' + 13 is always 'Q'.
On my computer at home 'D' is 68 and 'Q' is 81, no problem there.
On my computer at school, 'D' is 196, 'Q' is 216, and 'D' + 13 is 209,
which is 'J'. Problem.
What to do?
Hans said:....
But, if I remove -pedantic, it works still not:
lc -ansic -unused -shadows -O aprog.c
Error aprog.c: 14 invalid type specification
1 error, 0 warnings
1 error
Is signed int short bar = 0; valid C?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.