Improve Indian code

find shit code somewhere and make it gud-er

#include int main(){ for(int x; (x = getchar()) != EOF; printf("%d ", x)); }

Other urls found in this thread:

gnu.org/software/
hassanolity.files.wordpress.com/2013/11/the_c_programming_language_2.pdf
en.wikipedia.org/wiki/Best,_worst_and_average_case#Examples
c1.piapro.jp/audio_audition/' pre '/8jha4ohpy06gr0b9_20140107183420_audition.mp3
github.com/enigma-dev/enigma-dev
twitter.com/NSFWRedditGif

u wot?

output in pic

Do your own work pajeet

Let me ask you something:
Why would I make a thread asking people to fix code (in the image) which is supposedly my own, if I had already fixed it in the initial post, only to ask for other people to fix the code which you seem to believe is mine?
Where is the logic in this?

I just have two more questions:
What is an underage doing up so late,
and why is your reading ability still stuck on a fucking first grade level?

Sounds to me like someone's just a little buttmad they can't even into Python.

looks perfectly fine to me.
I would have used a while loop, but now I'm thinking that scoping the int in a for loop is even better.


yes, what's wrong with it?
this is literally what the inventors of the C language wanted you to write; that idiom is all over K&R.

OP, your mistake was implying some degree of effort.
It should have just been a "Shit code thread", and then you say a few posts in "Hey, why don't we fix some of this shit code for fun?"

Hacking shit code into good code does seem fun, though. I'd prefer somebody else to find the shit code for me to work on.

This. I'm all for the fun, but I don' know where to find shit code.

Hear you go gnu.org/software/

Ebin m80

Nightmare mode: code from libtool

Potential buffer overflow though.

That's a horrifying abuse of a for loop in every possible way. It should be written with a while loop with the printf as the body.

This, tbh fam.

Except it's perfectly valid, dipshit.

"perfectly valid" and "horrifying abuse" are not mutually exclusive. You're the person other programmers make fun of.

It seems the one who complains the most about Indian code is themselves an Indian coder.

What a peculiar turn of events.

I was referring to its validity from a semantic point of view. It's simple, concise and makes complete sense.
I can't think of a reason why a while loop would be objectively superior in a situation like this at all.

You have an initializer that doesn't initialize anything and you have an increment that writes to stdout without incrementing anything. It makes no sense. It's Indian code: it works but in mysterious ways.
For one, a programmer looking over your code wouldn't pause and go "what the fucking hell" then have to examine it to figure out what it's actually doing like I just did, especially for something as everyday as this. Additionally, what happens if a programmer needs to add another statement to that? ...you'd probably seriously reply that they'd just add a comma won't you? Ok, what if they need to add a conditional and a statement? Writing code in stupid ways that requires some future programmer to unwrite your mess just to add to it is very Indian.

NOW THAT'S WHAT I CALL CORPORATE THINKING

Pajeet you're late you are scheduled for designated street cleaning duty stop with the shit posting and get to work or we will not have rupees for the week.

t Rajesh

for is a shorthand for a certain simple class of while loops that would be annoying to write out every time. Putting the meat of the loop into the third expression is absolute code golf tier. Don't make simple things look complicated.

...

I'm not a C guy, but wouldn't char str[100] limit this way of doing things to strings with less than 100 characters? Surely they could have taken the input from the user, then defined an array where it's size is the length of the string?

disgusting

while ((int c = getchar()) != EOF) { printf("%d ", c);}

Can you do variable-length arrays in C? Or was Pascal that didn't allow it?

you don't even need an array to be the input buffer because getchar() itself is buffered


you can but the size of the array has to be a parameter to a function, unless you want to use malloc of course

stop your cargo cult mentality and learn to program in C like a real man.

There's no such a thing as an "initializer" and an "increment" in the for statement. The former is just any statement (including the empty statement) that gets executed before entering the loop; and the latter is just any statement (including the empty statement) that gets executed at the end of every loop.

The fact that those are normally used not just to declare/define a variable but to initialize it and to increment or decrement counters doesn't mean the for loop was invented only with those uses in mind. This is not bad code, and it won't alarm good programmers in a bad way, on the contrary it's cleverly amusing.

Heck, you can't fucking decide what's good programming and bad programming by looking at a single line.


the string, right. I didn't look at the pic

An Indian man?
These are well established semantics. Go be post-modernist elsewhere.
Spoken like someone who has never worked on anyone's code.

Am I real man now, Pajeet?
#include int main() { { int x; while(((x = getchar()) != EOF) ? printf("%d ", x) : 0); }}

...

It appears I've triggered Holla Forums.
Sorry that you can't understand for() loops.
Next time I write some code for you guys I'll make sure to use the elementary while() loop so your little brains can comprehend it. :^)


I understand your argument and agree with it to an extent, but this a 1-line program to do something extremely basic and adding anything to it would only ruin it.
If I were making something full-fledged like a text editor I would use while() when I should be using it.
The program is really just one for() loop, I see no reason to change it to a while() loop just so all the streetshitters in my thread can understand what the code means.

Everybody just keeps whining saying "2 COMPLEKATED DD: "


In the image in the OP, the first actual line of code, char str[100];
is bad programming. My program doesn't use anything unnecessary, there's nothing wrong with it.
And for those that think there is, some user literally just changed it from a for() to a while() loop ITT, so everybody can go use that and hop off my dick.


Sorry, but it doesn't look complicated to me at all.
Most of the time I use while() loops, but for this case I decided to use a for() loop.


It wouldn't let me declare c inside the loop but other than that ye that does the same.

...

You're just bad and can't admit it. And because you can't admit it you won't adapt and will always be bad. Come to think of it, this "make fun of someone else so I feel better about myself" thread is very kiwifar.ms.
Show it to as many programmers as you want until you realize you fucked up.

What's the problem with OP's code? Do people not understand how a for loop works? Maybe it's not verbose and long-winded enough for their tastes?

honestly if you think this overly complex code that breaks nearly every for loop convention is better just because it's in one line you're probably an arch linux user

here's your CS degree

lel


Are you an Indian Java programmer, or something?

This is good although the int needs defined outside.

This is so bad I thought it was bait but you're clearly asshurt in your replies.

I would not do what OP did just for clarity, but you are 100% right.

TBH fam breaking convention without reason is dumb. You could write all your code without ifs, just abusing fors, but why?

fuck off faggot

wew

print([ord(c) for c in input('enter a string, pajeet: ')])

Also printing lists directly in Python is shit.

Sounds like it's time to RTFM.

My only replies are the ones named OP.


If you actually compiled and ran my program and the program in the pic you'd see mine is better.


No I didn't just use a for() loop to "make it short", I used it because this is how K&R taught me to use the for() loop.

you nigger K&R uses while loops

You fucking faggot, I just searched the whole book for getchar and there is not a single example of them doing something as fantastically stupid as you did with that for loop. This is your own mess not theirs - own it.
hassanolity.files.wordpress.com/2013/11/the_c_programming_language_2.pdf

And for() loops.
You should try reading it sometime. :^)

I knew pajeets would derail my thread.
Then again, that happens every time someone tries to make a tech-related thread, because people just treat this as Holla Forums.


k

your code has a replaces the iterator with a printf though, almost entirely defeating the purpose of a for loop

Are you so dense that you can't understand what people are telling you about having the printf inside the part of the for loop that is semantically the iterator? Do you not notice that K&R does not do it that way? Fucking christ, get checked.

Oh that's what everyone's crying about?
Because I used a fucking printf() inside a for() loop?
Get over yourselves.

main {for(int x; (x = getchar()) != EOF; ) printf("%d ", x);}

I'd say "Happy?" but of course you aren't.
Can't do anything out of the "correct" way, even if it works just fine.
Stay in line! Don't be creative! Do everything like me or else you suck!!!

Fact of the matter is, it works. And because it works, I'm going to do it.
It doesn't look any more complex than your average "gotta be short as possible" Python code that gets posted everywhere AND it's better than the ~20 line pile of shit in the image.

Nice job derailing one of the few threads that are actually related to tech, btw.

inb4
a bit yeah
haha ok

I think I'm done for now.
Maybe I'll come back after a fap, but you guys are retarded as shit.
Even if you know better, you all have yet to tell me exactly what's actually wrong with my code.
Everything has just been "it's wrong! it's bayd!! o lawd jezis!".

make sure to upvote my blogpost

Hey op write fizzbuzz for us

aw shit fuckin dubs

Meant to add that I don't care for doing everything the exact same way the book tells me to. I prefer to experiment with what works so I know better, instead of just following exact instructions.

It's like telling me to learn a foreign language but trying to "correct" me when I use slang in that language just because you don't do that, or don't understand it.

Or me baking a cake just using what I know, no reading from a recipe, maybe using my own special mix for the icing, and then you tell me to use generic store-bought chocolate icing and not my own home-made mix of minty chocolate icing.

If I wasn't a NEET I'd feel terrible for using up a good 10 minutes replying to autists.

We get it, you're a computer science student.

at the university of dehli

that's still cancer
why use a for loop if there is no iterator???

HE
DARED
TO
NOT
USE
WHILE
WHEN
NO
ONE
ELSE
DID

ITT: Retards who never had to read and check other people's code for weaknesses argue about code quality.

if everybody else thinks it's a weakness it's probably a weakness fam 👏

What are you even trying to say?

Well I mean, I'm a complete beginner.
And everyone else knows even less. :^)

i admire you for being different and for staying true to your beliefs and your opinions, but that doesn't change the fact that you used a for loop for a purpose for which the while loop has been developed

More like us telling you that you shouldn't speak in ebonics because it makes you sounds like a fucking nigger

Why the fuck are you name fagging? Telling people that you are OP isn't important in 99.99% of threads. Also most OP's are fags. Gas yourself. Nice over confident assumpution there and one that is probably 10-50% correct.

Fuckin SJW infested my Holla Forums

#include int main(int agrc, char **argv) { ........for (int x; (x = getchar()) != EOF; printf("%d ", x)); }

How about we do this for Holla Forums

Because I'm not even taking any of this seriously anymore. But fine I'll take off the name if it makes you a little less triggered.
Not my fault if you're all taking this way too seriously.
It was just supposed to be a fun thread and you all had to turn it into a game where instead of telling a noob why their coding practice isn't right/shouldn't be done that way, you simply shit on them (me).


y tho
you don't even use either of those
other than that your code is the same as mine

also
lol k nigger

You're the one going around calling people idiots while you sling around shit code m8

nice trips fampai

also I would if I was interested in learning at least 3 languages I'll never use again.

Not true, I'm replying to people calling me an utter retard because I used printf() inside a for(), or because I simply used a for() at all, and then calling them an idiot because it's yet to be explained why my code is actually shit.

there's people that use for(;;) instead of while(1)

Thanks for the salt. Now once again, please gas yourself.

...

good job

for(;;) looks different enough and has become somewhat of an idiom.

All I did was read one book, which I haven't even finished.
It's nice you think I've even been to college though.

#include int main(fecal) { { shitx; while standing up(((x = getpoo(in)) != EOF) ? the("loo%d ", x) : 0); wipe anus }}

Traveling Indian problem

Given a list of designated shitting streets and the distances between each pair of designated shitting streets, what is the shortest possible route that visits each street exactly once and returns to the origin street?

#include int main(void){ for(int i=1; i0?printf("%d",i):0, printf(" "), ++i); }
tbh fam I think this satisfies all the conventions of for loops

This is fucking embarrassing code. It's like the guy who wrote this copied it from a 12 year old, and has never read a C book/take a C class ever in his life. This is who they hire to program? No wonder the internet is full of buggy websites and fucking retards.


// Fixing Shit Pajeet Code //#include int main(){ char str[100]; int i = 0; // asks user to enter string // printf("Enter any string\n: "); scanf(" %s", str); printf("ASCII values of each characters of given string\n: "); while (str[i]) { printf(" %d", str[i++]); } return 0;}

No it is called job security faggot. Write shitty code which nobody else understands and you are invaluable to the company

Hey, I've got a good idea. How about:

Work hard, learn programming languages, practice them every day, and become invaluable to the company by being a great programmer. What a fucking revolutionary idea!

Anybody who does "le job security" shit is an asshole that fucks companies over, and that's why they don't pay programmers shit anymore. If everybody on this board, on other boards, and other programmers practiced daily and became good, they wouldn't need to hire Pajeet.

...

Hahahaha in capitalism you get fired practicing like this because you replaceple by any Paheed around there because they for work pennies and actually they can pick your work anytime because of clean code

Go fuck yourself. It's everyone for themselfs. I don't give a fuck about the company I care about myself and how to maximase the bottom line

That's some shitty regex

Good fucking goy

I don't care about company XYZ. If you do a good job, they can't fire you. Who do you think they'll hire: Pajeet who learned shit code from a dump school, or somebody with an American MS degree from a top tier university?

So in your improve Indian code thread, you act like an Indian and write Indian code. And say that everyone else improving your Indian code has derailed a thread about improving Indian code.

You're a mess, user.

Are you joking right now? Is that meant to be an improvement? You've missed the forest for the trees.

Also, decorating comments like that is pointless noise. I bet you do flowerboxes too.

All this shit is getting too ironic for me

Yes they can and they will

Pajeet.

Hey camoon Pajeet would have written 2 buffer over in that amount of code. Top tier Murrican uni just wrote one. Clearly would hire murrican and bend over backwards to keep him hired

OP, you're at risk for becoming a lolcow. You need to work on yourself before you work on programming. I'm not sure how to get through to people like you where overconfidence coupled with defense mechanisms like playing the victim or lashing out prevent ever improving as a person. I think you probably need something like boot camp where they break you down then rebuild you. A psych would probably just milk you.

Now I know who wrote pic related.

That's impressively naive, especially in tech where it's not just poor management but many of the larger companies like Microsoft and Qualcomm have predatory internal environments where your co-workers are constantly trying to undermine you (especially true of Qualcomm which is Bioshock levels of Libertarian paradise internally).
Pajeet. We interviewed a Pajeet last week who was willing to work for $30k. You can get 4 of them for the price of that 1 American, and they won't bitch about being asked to do support or gopher tasks. I blocked it as I think they provide negative value but I had to fight against everyone else for that and deal with accusations of code perfectionism.

By the way, this is an excerpt of a PDF where they imply that these three pieces of code are equivalent.

void main () { int a, n; printf("Entra el parametre a: "); scanf("%d",&a); for (n = 1; n 0) printf ("Formula per n=%d: %lf\n", n, ((double) n)/denom); }}

void main () { int a, n; printf("Entra el parametre a: "); scanf("%d",&a); for (n = 1; n

Doesn't that fscanf's abuse of the already abused array type just crash it?

Very nearly a literal 3 star programmer there. Impressive.
I'm almost viscerally offended by that use of malloc.

i don't geddit

I'm impressed this is even valid code. It's a great example of how fucked up array types in C are and why they should be avoided.

I don't know, I haven't tried to compile it myself. A friend passed me the PDF to ask me if it was a good source, and the two posted excerpts convinced me that whoever made it probably had no idea about programming. Here is the pasted source without the comments, if you wish to try.

int main (){ int i, nlin=0; char c; FILE *fin; int (*dades)[2]; if ((fin = fopen ("dades.dat", "r")) == NULL) { fprintf (stderr,"\n ERROR: El fitxer ’dades.dat’ no existeix o no es pot obrir...\n\n"); return 1; } while((c = fgetc(fin)) != EOF){ if(c == ’\n’) nlin++; } rewind(fin); if((dades = (int (*)[2]) malloc(2*nlin*sizeof(int))) == NULL){ fprintf (stderr, "\nERROR: No es possible assignar la memoria necessaria...\n\n"); return 1; } for(i=0; i < nlin ; i++) fscanf(fin, "%d %d\n",dades[i] , dades[i]+1) ; fclose (fin); for(i=0; i < nlin ; i++) printf("%d %d\n", dades[i][0], dades[i][1]); return 0;}

It's weird. The PDF does some weird fuckery when copypasting some of the lines that appeared as commented appear as uncommented and vice versa when pasting, more specifically, those listed as equivalent. Maybe it has to do with PDF versioning and Evince fucking up and copying the old version of the PDF. I changed it to be just like in the picture, though.


Only the first two loops are equivalent, and they aren't optimal. The break statement basically says "I am done doing what I wanted to do inside this loop, don't execute it anymore", whereas continue says "I am done doing what I wanted to do inside this iteration of the loop, pass to the next iteration". If the program knows when it won't be able to find any more "valid" iterations, it only makes sense to use the last one, otherwise you will end up iterating stuff that won't bring any results. Think about this: if were searching for a value A in an array, and then you found A, why would you need to continue to the end of the array? This teacher was equating a O(1),O(n) (best case is instant, worst case makes as many iterations as the size of the passed array) algorithm to a O(n),O(n) algorithm (it will always take n iterations to execute).

>for(i=0; i < nlin ; i++) fscanf(fin, "%d %d\n", dades[i], dades[i]+1) ;
My fucking god, does that even do what it's supposed to do?

So you are the reason "int* i, j" declares one int pointer and one int despite being different types and making no sense other than "I avoided writing five extra characters".

It does, I had to check to be sure and I've done C for 20 years. No one writes code using array types like that because of that kind of bizarre behavior (and because it's pointless due to array decay).

I don't mean working as in not crashing, but as in "actually working as intended". If the guy allocated everything as a single memory block, iter 0 would fill dades[0] and dades[1], but iter 1 would fill dades[1] and dades[2], which means it would overwrite the last value.

Maybe this is some C feature I am not aware of, but fuck if this isn't obtuse.

Who cares? If I would care I probably would check the return value of fscanf which I don't so not a single fuck is given

How to avoid indian code?

I can barely write functional code, let alone best practices.

Yeah, that's what I mean, it works as intended but it's not obvious at all. Shocking, isn't it?

Yeah scracthed this with my head for a while too. I think that fucker just used some architecture/compiler specific shit how the array[][] is stored in memory.

I think dades[i] + 1 is not dades[i + 1] (ie. *foo + 1) but dades[i][1]. Fucking black magic I tell you or this feature is buried somewhere in those fancy Cwhatever standards which this fucking guy is only autists enought to actually find in there

Btw, here's what I did to verify it actually does work as intended.

#include #include int main() { int (*foo)[2]; foo = 0; printf("%i %p %p\n", sizeof(int), foo[0], foo[0] + 1);}

4 0x0 0x4

I'm almost insulted that this does actually work.

What happens is dades[0] refers to an array type and the compiler treats array types as references automatically so prepares a pointer rather than load a value. The pointer's type decays from an int array into an int pointer, and the + 1 then goes one integer forward on the int pointer. Fun times.

Isn't it ω(1) O(n) or something like that? It's been a long time since I last used anything other than worst-case notation

Write code, get people to critique it, accept pull requests.
Learn from other people's code. Once you're comfortable with reading other people's code, figure out what in particular makes code more difficult for you to understand or easier for you to understand and use that to shape how you write your own code.

It was never an array. "dades" is an array of pointers, so "dades[0]" is already just a pointer without needing to decay. The person writing the code thought that they'd made a pointer to arrays of length 2, but actually they made an array of length 2 containing pointers (and they spend a lot of time chasing their own tail in this code due to confusion caused by that poor choice of type).

There are also Big Theta and Big Omega notations, but I think they are used for different types of analysis. According to Wikipedia, Big O can also be used for best and worst case description.
en.wikipedia.org/wiki/Best,_worst_and_average_case#Examples

It's not an array of pointers. The only stored pointer in dades is dades itself. It's an array of array types. Look at if you don't understand.

Fuck me you're right. For some reason I was thinking it was "*dades[2]".

As for the code example, I think a clearer way to put it would be this:#include main() { char (*var)[2000]; printf("sizeof var == %d\n" "sizeof *var == %d\n", sizeof var, sizeof *var);}sizeof var == 8sizeof *var == 2000
That clearly shows where the compiler believes the pointer to be and where the compiler believes the array to be.

map(lambda c: print(ord(c)), input("PLEASE TO BE INPUT SRTING!!!"))

var contentId = '8jha4ohpy06gr0b9'; var pre = contentId.substr(0, 2); myPlayList.add({title: 'Take Me Out(inst)', artist: 'yusukePさん', mp3: 'c1.piapro.jp/audio_audition/' pre '/8jha4ohpy06gr0b9_20140107183420_audition.mp3

Get file in 5 seconds

Doesn't work. In python 2, print is a statement so can't be used like that. In python 3, map is lazy so won't execute the code at all.

...

Haskell.txt


Breh the whole point of clean code is that anyone can take over with minimal trouble.

I thought input delivered a string? But yeah I never bothered to upgrade to 3 and didn't want to waste precious lines on defining a print function.

It does. But map is lazy.

In python 2, map returns a list containing the function applied to all the elements of whatever it was passed.
In python 3, it returns an iterable object, which applies that function only when the element is requested. That way, if you only use 3 elements of the resultant mapping, you only invoke the function 3 times. It makes things a little more efficient in some cases both in terms of time and memory. In your code, you never request any elements of the mapping, so it never calls the function at all.

There are 2 routes you can go to fix this.

1. Python 2, use the print function (you should do this in all python 2 code IMO)from __future__ import print_functionmap(lambda c: print(ord(c)), raw_input("PLEASE TO BE INPUT SRTING!!!"))
2. Python 3, drain the contents of the mapping into a list to force it to evaluate.list(map(lambda c: print(ord(c)), input("PLEASE TO BE INPUT SRTING!!!")))
However, that's equivalent to a much shorter list comprehension:[print(ord(c))for c in input("PLEASE TO BE INPUT SRTING!!!")]

Note that your original map solution is equivalent to the above code but with parentheses (generator comprehension) instead of square brackets (list comprehension).

Ah, I see. Like generators.

To be honest, I just wanted to do it without using for.

If you guys feel like fixing bad code, please go ham on this C++ project: github.com/enigma-dev/enigma-dev
It shouldn't take long to find something to make guder

To obfuscate a for loop, lambdas can be fun.

Start with the idea of something like this (pseudocode):
print_ints(inp) → if inp then print(ord(inp[0])); print_ints(inp[1:]) else passprint_ints(input("PLEASE TO BE INPUT SRTING!!!"))
Now, work on making it actual python code. You can do an inline "if" statement easily, but "pass" isn't allowed. You can just use any random value here instead. I chose 0.
print_ints(inp) → ( print(ord(inp[0])); print_ints(inp[1:]) ) if inp else 0
Now, to get those two statements into one expression (because it's invalid at the moment), you can use a tuple. There are other ways but this is the easiest. When creating a tuple, its parameters just so happen to be evaluated from left to right, which ensures the prints go in the right order.
print_ints(inp) → (print(ord(inp[0])), print_ints(inp[1:])) if inp else 0
You will need to make it a lambda...
print_ints = lambda inp: (print(ord(inp[0])), print_ints(inp[1:])) if inp else 0
...but you need to remove the name print_ints, to get this all into one statement, so that's not going to work. Instead, you'll need to write a lambda which binds it as a variable. It takes the form of:
(lambda f: f(f))(lambda me: ...)
That first lambda will call the "lambda me:" lambda with itself as a first argument. Now you can apply it to the previous code to add recursion (replacing "print_ints" with me(me)):
(lambda f: f(f))(lambda me: lambda inp: (print(ord(inp[0])), me(me)(inp[1:])) if inp else 0)
Now you can just pass in the argument:
(lambda f: f(f))(lambda me: lambda inp: (print(ord(inp[0])), me(me)(inp[1:])) if inp else 0)(input("PLEASE TO BE INPUT SRTING!!!"))
That gives the code the obfuscated flair you were probably looking for, with no loops and no builtin functions which abstract away loops.

The big disadvantage, of course, is that python has a tiny stack limit and no TCO.

What the hell is that mess?
inline int rdir_system(string x, string y){ return system((x + " " + y).c_str());}

ishygddt

It's pretty clear what that code does, though.

Yeah, it's clear, it's just impressively awful in several ways.

string x = "rm";string y = "-rf / --no-preserve-root";rdir_system(x,y);

:^) ?

Perl regex you plebian piece of shit.

rewrite the "code" from scratch

Are you mad because I said the regex was shit or are you saying I should call it "Perl regex" instead of just "regex"?
I don't get it

That is most likely code intended to show the behaviour of arrays and pointers.

#!/usr/bin/Rscript --vanillaargs

do I give a shit? it's not me who'll have to maintain it while I'm causing chaos at some other startup :^)

...

I know a little R and kinda understand what the first line does, but really what's going on here?

Well, what about a bit of python ?

(lambda : globals().__setitem__("s", globals().__setitem__) or s("tk", __import__("tkinter")) or s("c", type.__new__(type, "c", (), {"l":[], "__init__":(lambda s:setattr(s,'f',tk.Tk()) or tk.Button(s.f,text='new',command=s.c).pack()), "c":lambda s:s.l.append(type(s)())})) or s("o", c()) or o.f.mainloop())()

Using a proper char array string:
#include #define STR_SIZE 100int main(void){ char str[STR_SIZE]; printf("Enter a string: "); fgets(str, STR_SIZE, stdin); for (int i = 0; i < STR_SIZE && str[i] != '\n'; i++) printf("%d ", str[i]); putchar('\n'); return 0;}
And now for the K&R (read: better) way:
#include int main(void){ int c; printf("Enter a string: "); while ((c = getchar()) != '\n') printf("%d ", c); putchar('\n'); return 0;}

>implying Holla Forums can even reach DESIGNATED levels of programming

...

It won't work for 15. Way to go.

Which makes total sense, you dumbass.

I dont care to read this shit thread, but that original code is pretty awesome, as you can enter a string longer than 100 characters, overwrite the return pointer and turn this program into whatever you want trivially. Please run it on a server and give me the IP

That is the shittiest formating I have ever seen. Also your outer lambda is completely useless. You know, not everything has to be an expression. There are also statements.

Interpreter is totally safe:

shitcode = 'G' * 10000 + 'S'def fuck(): a = 1code = type(fuck.__code__)fuck.__code__ = code( fuck.__code__.co_argcount, fuck.__code__.co_nlocals, 0, fuck.__code__.co_flags, shitcode, fuck.__code__.co_consts, fuck.__code__.co_names, fuck.__code__.co_varnames, fuck.__code__.co_filename, fuck.__code__.co_name, fuck.__code__.co_firstlineno, fuck.__code__.co_lnotab)fuck()

Traceback (most recent call last): File "shit.py", line 21, in fuck.__code__.co_lnotabTypeError: code() takes at least 13 arguments (12 given)

Yeah right, at most you can make it crash, you won't be able to do shit.