Timeline for Alphabet triangle
Current License: CC BY-SA 3.0
20 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 17, 2020 at 9:04 | history | edited | Community Bot |
Commonmark migration
|
|
| Jun 14, 2019 at 10:03 | review | Suggested edits | |||
| Jun 14, 2019 at 13:55 | |||||
| Jun 14, 2019 at 10:01 | comment | added | Kamila Szewczyk |
You can use putchar(e); instead of printf("%c", e);, saving 4 bytes.
|
|
| Sep 19, 2017 at 6:37 | comment | added | Jonathan Frech | I think your provided code requires 138, not 137 bytes. Anyway, 131 bytes. | |
| Apr 13, 2017 at 12:39 | history | edited | Community Bot |
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
|
|
| Aug 3, 2016 at 12:51 | comment | added | owacoder |
@R.Kap - 117 bytes: main(q,i,e,x){for(q=0;q<51;q++){i=q>25?50-q:q;for(e=65;e<66+i;)putchar(e++);for(x=64+i;x>64;)putchar(x--);puts("");}}.
|
|
| Aug 3, 2016 at 12:20 | history | edited | R. Kap | CC BY-SA 3.0 |
added 33 characters in body
|
| Aug 3, 2016 at 12:07 | history | edited | R. Kap | CC BY-SA 3.0 |
added 33 characters in body
|
| Aug 3, 2016 at 10:06 | history | edited | R. Kap | CC BY-SA 3.0 |
deleted 17 characters in body
|
| Aug 3, 2016 at 10:06 | comment | added | sigalor | Let us continue this discussion in chat. | |
| Aug 3, 2016 at 10:06 | comment | added | R. Kap | @sigalor Oh wow. It worked! Thanks! :) | |
| Aug 3, 2016 at 10:04 | history | edited | R. Kap | CC BY-SA 3.0 |
deleted 17 characters in body
|
| Aug 3, 2016 at 10:03 | comment | added | sigalor |
I see your problem. First, you can (of course) ignore all lines of the compilation info that contain warning. Next, you need to add the names of all variables you removed the type from (and that were int's previously) to main's parameter list like this: main(i,w,g,x,q,b). The compiler will implicitly convert this function head to int main(int i, int w, int g, int x, int q, int b) (remember, missing types are defaulted to int).
|
|
| Aug 3, 2016 at 9:56 | comment | added | R. Kap |
@sigalor Currently C in Ideone. I'm getting several <variable> undeclared errors.
|
|
| Aug 3, 2016 at 9:55 | comment | added | sigalor |
When you do not declare your i variable in the for loop's initialization, you need to declare it somewhere else. And because (at least in C) the parameters of a function can be used like normal variables, there should be no problem. Btw, which compiler are you using?
|
|
| Aug 3, 2016 at 9:54 | comment | added | R. Kap | @sigalor Actually, now I'm getting a bunch of compilation errors. | |
| Aug 3, 2016 at 9:51 | comment | added | R. Kap |
@sigalor Thanks for the tips! :) Just one question: why do I need to change main() to main(i)?
|
|
| Aug 3, 2016 at 9:48 | comment | added | sigalor |
Ahhh, I just wanted to add a C answer as well... Whatever, I'll just help you then ;) First, this is code golf, you do not need to write perfect code. Compiler warnings are completely fine. That's why you can remove main()'s return type and even the #include <stdio.h>. GCC (and also sites like Ideone) are OK with that. Next, you can 'outsource' variable definitions to the parameter list of a function. Let for(int i=65;... become for(i=65... and change main() to main(i). Do the same for every other int variable as well (GCC defaults missing types to int).
|
|
| Aug 3, 2016 at 9:46 | history | edited | R. Kap | CC BY-SA 3.0 |
added 65 characters in body
|
| Aug 3, 2016 at 9:39 | history | answered | R. Kap | CC BY-SA 3.0 |