Generally, I'd post the code unless it's, say, over a thousand lines long. People, myself included, don't like the extra work entailed in clicking on an attachment.
If you're worried about readability, colouring the code with a syntax highlighter like codeform can be nice.
What's easier to read? This?
Code:
#include <stdio.h>
int main(void) {
printf("Hello, World!\n");
return 0;
}
Or this?
Code:
#include <stdio.h>
int main(void) {
printf("Hello, World!\n");
return 0;
}
Codeform can be run online here: dwks.theprogrammingsite.com/myprogs/cfonline.htm
(Yes, it's true, I wrote codeform. So don't take me too seriously. But it really does make a difference for really large programs . . . there are other syntax highlighters around too, if you hate codeform or something.)
As for limits . . . well, someone once posted the first million or so digits of PI, I think, so if there is a limit it's pretty high.