am i doing it right?
1
Name:
Anonymous
2010-04-04 19:00
#include <stdio.h>
#include <stdlib.h>
int
main (void)
{
int x, y;
fputs ("1st int: ", stdout);
fscanf (stdin, "%d", &x);
fputs ("2nd int: ", stdout);
fscanf (stdin, "%d", &y);
fprintf (stdout, "sum = %d\n", x + y);
return EXIT_SUCCESS;
}
2
Name:
Anonymous
2010-04-04 19:04
Space before function opening parenthesis
YOU'RE DOING IT WRONG
3
Name:
Anonymous
2010-04-04 19:10
2 space identation
Real men use 4 spaces.
4
Name:
Anonymous
2010-04-04 19:15
>>2
>>3
GNU style indentation
5
Name:
Anonymous
2010-04-04 19:19
>>4
Implying GNU style identation is right or manly
6
Name:
Anonymous
2010-04-04 19:21
7
Name:
Anonymous
2010-04-04 19:26
>>3
I thought we had all agreed that 3 spaces was the way to go.
8
Name:
Anonymous
2010-04-04 19:28
Style aside, is it good?
9
Name:
Anonymous
2010-04-04 19:29
>>6
You know what, just leave. We don't need your kind around here.
10
Name:
Anonymous
2010-04-04 19:31
>>3
So say you're coding. What are you going to be coding? Of course, it's an ANSI C compiler. So you're writing code. What are you writing your code in? Of course, it's cat. Now you want to indent your line. What key do you hit? Of course you'll type a tab. NOW HOW MANY CHARACTERS DOES YOUR CURSOR ADVANCE, MOTHERFUCKER, EH?
11
Name:
Anonymous
2010-04-04 19:32
>>1,8
back to /b/, please
12
Name:
Anonymous
2010-04-04 19:48
13
Name:
Anonymous
2010-04-04 19:58
R e a l m e n u s e t a b , t h e n w h a t e v e r I D E / t e x t e d i t o r y o u a r e u s i n g d i s p l a y s i t a s h o w e v e r m a n y s p a c e s y o u s e t t a b t o b e
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
int x, y;
fputs ("1st int: ", stdout);
fscanf (stdin, "%d", &x);
fputs ("2nd int: ", stdout);
fscanf (stdin, "%d", &y);
fprintf (stdout, "sum = %d\n", x + y);
return 0;
}
O R ( t h e a s s h o l e w a y )
#include <stdio.h>
#include <stdlib.h>
int main (void){
int x, y;
fputs ("1st int: ", stdout);
fscanf (stdin, "%d", &x);
fputs ("2nd int: ", stdout);
fscanf (stdin, "%d", &y);
fprintf (stdout, "sum = %d\n", x + y);
return 0;
}
14
Name:
Anonymous
2010-04-04 20:08
>>4
GNU style is a bit different, though.
15
Name:
Anonymous
2010-04-04 20:19
>>10
What about us folks who are not stuck in the past and use Vi and make it display unindented lines with eight spaces in front and once-indented as
"> text starts here", and twice-indented as
">> text starts here", and so on, so the text lines up perfectly, eh? EH?
16
Name:
Anonymous
2010-04-04 21:01
>>15
You're okay by me. Just mind your code does not go past the 80th column when viewed with real tabs, or gramps will have to kick your ass. I reckon you can even make your fancy editor mind it for you.
17
Name:
Anonymous
2010-04-04 21:07
>>16
Get a new monitor, hippie. It's not 1970 anymore, we use better resolutions than 320x240.
18
Name:
Anonymous
2010-04-04 21:20
>>16
My
roxterm defaults to 80x24 and I'm quite happy not maximising it,
thank you very much .
19
Name:
Anonymous
2010-04-04 22:02
>>18
Yeah, well, my monitor is 1440x900 native. Don't bitch at me when it's you that has the problem sticking to outdated standards.
20
Name:
Anonymous
2010-04-04 22:24
>>19
The table in my living room is ten feet long, and yet those stupid newspapers keep printing their text in tiny columns. No wonder print is dying.
21
Name:
Anonymous
2010-04-04 22:54
>>20
I
s e e what you
d i d t h e r e
22
Name:
Anonymous
2010-04-04 23:42
>>20
Suggesting that table size is standardized and a valid metric for newspapers, which have nothing to do with tables, unlike programming which is inextricably related to monitor resolution
At first I was like щ(゚Д゚щ)
But then I was like ( ≖‿≖)
23
Name:
Anonymous
2010-04-04 23:45
24
Name:
Anonymous
2010-04-04 23:51
What C coding standards does /porg/ follow? GNU? Standard C? etc.
25
Name:
Anonymous
2010-04-04 23:58
26
Name:
Anonymous
2010-04-05 1:08
C Coding Standard
27
Name:
Anonymous
2010-04-05 1:09
>>1
No should be
#include <stdio.h>
#include <stdlib.h>
int
main(void)
{
int x, y;
fputs ("1st int: ", stdout);
fscanf (stdin, "%d", &x);
fputs ("2nd int: ", stdout);
fscanf (stdin, "%d", &y);
fprintf (stdout, "sum = %d\n", x + y);
return EXIT_SUCCESS;
}
28
Name:
Anonymous
2010-04-05 2:55
#include <stdio.h>
#include <stdlib.h>
int main(void){int x, y;fputs ("1st int: ", stdout);fscanf(stdin, "%d", &x);fputs ("2nd int: ", stdout);fscanf (stdin, "%d", &y);fprintf (stdout, "sum = %d\n", x + y);return EXIT_SUCCESS;}
FV style is the only true style.
29
Name:
Anonymous
2010-04-05 3:00
>>28
#include <void.h>
main(){int x,y;fputs("1st int: ",stdout);fscanf(stdin,"%d", &x);fputs("2nd int: ",stdout);fscanf(stdin,"%d",&y);fprintf(stdout,"sum = %d\n",x+y);}
30
Name:
Anonymous
2010-04-05 4:23
>>29
#include <void.h>
mainstart ir x,y;fputs("1st ir: ",stdout);fscanf(stdin,"%d", &x);fputs("2nd ir: ",stdout);fscanf(stdin,"%d",&y);fprintf(stdout,"sum = %d\n",x+y) mainend
31
Name:
Anonymous
2010-04-05 4:24
>>30
Wait, the void.h version is actually longer then youre sepples-level defective bloat. Screen real estate is not conserved, sheeple.
32
Name:
Anonymous
2010-04-05 5:03
#include <stdio.h>
int main(void)
{
int x, y;
puts("1st int: ");
scanf("%d", &x);
puts("2nd int: ");
scanf("%d", &y);
printf("sum = %d\n", x + y);
return 0;
}
Only correct way.
33
Name:
Anonymous
2010-04-05 6:13
Why don't you use printf when you use scanf?
34
Name:
Anonymous
2010-04-05 6:36
>>33
Because..dude, its OPTIMIZED
35
Name:
Anonymous
2010-04-05 6:50
int x, y;
Should be an array with two values.
36
Name:
Anonymous
2010-04-05 13:35
…………………...„„-~^^~„-„„_
………………„-^*'' : : „'' : : : : *-„
…………..„-* : : :„„--/ : : : : : : : '\
…………./ : : „-* . .| : : : : : : : : '|
……….../ : „-* . . . | : : : : : : : : |
………...\„-* . . . . .| : : : : : : : :'|
……….../ . . . . . . '| : : : : : : : :|
……..../ . . . . . . . .'\ : : : : : : : |
……../ . . . . . . . . . .\ : : : : : : :|
……./ . . . . . . . . . . . '\ : : : : : /
….../ . . . . . . . . . . . . . *-„„„„-*'
….'/ . . . . . . . . . . . . . . '|
…/ . . . . . . . ./ . . . . . . .|
../ . . . . . . . .'/ . . . . . . .'|
./ . . . . . . . . / . . . . . . .'|
'/ . . . . . . . . . . . . . . . .'|
'| . . . . . \ . . . . . . . . . .|
'| . . . . . . \„_^- „ . . . . .'|
'| . . . . . . . . .'\ .\ ./ '/ . |
| .\ . . . . . . . . . \ .'' / . '|
| . . . . . . . . . . / .'/ . . .|
| . . . . . . .| . . / ./ ./ . .|
37
Name:
Anonymous
2010-12-20 18:51