#include
#include
int main(int argc, char *argv[])
{
printf("Hello world\n");
return 0;
}
#include
#include
int main(int argc, char *argv[])
{
printf("Hello world\n");
return 0;
}
buy intel or nvidia
use windows 10
>undefined behavior
lad...
buy iPhone, poorfag
#include
#include
int main(int argc, char *argv[printf("Hello world\n")])
{
return EXIT_SUCCESS;
}
why does this work?
In a parameter list, you can put any expression inside [ ] if it returns an int.
print("Hello World")
echo "hello world"
Well at least you picked the correct language
> correct language
> undefined behavior
pick 1
main(){}
$=~[];$={___:++$,$$$$:(![]+"")[$],__$:++$,$_$_:(![]+"")[$],_$_:++$,$_$$:({}+"")[$],$$_$:($[$]+"")[$],_$$:++$,$$$_:(!""+"")[$],$__:++$,$_$:++$,$$__:({}+"")[$],$$_:++$,$$$:++$,$___:++$,$__$:++$};$.$_=($.$_=$+"")[$.$_$]+($._$=$.$_[$.__$])+($.$$=($.$+"")[$.__$])+((!$)+"")[$._$$]+($.__=$.$_[$.$$_])+($.$=(!""+"")[$.__$])+($._=(!""+"")[$._$_])+$.$_[$.$_$]+$.__+$._$+$.$;$.$$=$.$+(!""+"")[$._$$]+$.__+$._+$.$+$.$$;$.$=($.___)[$.$_][$.$_];$.$($.$($.$$+"\""+$.$$__+$._$+"\\"+$.__$+$.$_$+$.$$_+"\\"+$.__$+$.$$_+$._$$+$._$+(![]+"")[$._$_]+$.$$$_+"."+(![]+"")[$._$_]+$._$+"\\"+$.__$+$.$__+$.$$$+"('\\"+$.__$+$.__$+$.___+$.$$$_+(![]+"")[$._$_]+(![]+"")[$._$_]+$._$+"\\"+$.$__+$.___+"\\"+$.__$+$._$_+$.$$$+$._$+"\\"+$.__$+$.$$_+$._$_+(![]+"")[$._$_]+$.$$_$+"')"+"\"")())();
> code monkey
> knows how to program C
pick 1
not in C
in C++ maybe.
#include
#include
int main(int argc, char *argv[])
{
fprintf(stdout, "Hello world\n");
return EXIT_SUCCESS;
}
>#include
why
>int argc, char *argv[]
why
>printf
why
>\n
why
>return 0
why
#include
using namespace std;
int main()
{
cout
>using namespace std;
what's wrong with it?
i don't have to type std:: into every single fucking thing
not him, but it's like bringing a knife set to eat steak.
>not putting stds in everything you touch.
Casual.
>forgets the fucking closing quote
come the fuck on lad, you're not a fuckin pajeet are you?
It's called "variable length arrays" and you have been able to do that since C11. I'm a bit surprised that it works in function arguments though.
>smug post
>cant use proper syntax
sounds about Sup Forums
Works on my machine (clang)
main(int argc, char *argv[puts("Hello world")]){}
why? arguments are evaluated before they are passed, so it's just calling print and passing the return code to the function.
for larger projects its a bad idea because of all the problems that can arise from naming conflicts
if you absolutely want to avoid std:: then a better practice is to have using statements for the functions you want only:
using std::cout;
using std::endl;
declare i32 @puts( i8* )
@str = constant [13 x i8] c"Hello world\0A\00"
define i32 @main()
{
%tmp = getelementptr [13 x i8]* @str, i64 0, i64 0
call i32 @puts( i8* %tmp )
ret i32 0
}
.global go
.data
msg: .ascii "Hello, World\n"
handle: .int 0
written: .int 0
.text
go:
/* handle = GetStdHandle(-11) */
pushl $-11
call _GetStdHandle@4
mov %eax, handle
/* WriteConsole(handle, &msg[0], 13, &written, 0) */
pushl $0
pushl $written
pushl $13
pushl $msg
pushl handle
call _WriteConsoleA@20
/* ExitProcess(0) */
pushl $0
call _ExitProcess@4
"Hello world";
thanks terry
is this the new /wpc/?
Why is this undefined behaviour?
you don't even need stdlib for that.
10 PRINT "HELLO WORLD"
20 END
RUN
you're using it a single time, you end up typing much more.
what does this do? i.e. what language is it?
I tried bash and perl, both give errors
JavaScript
;hello.scm
(begin
(newline)
(display "Hello, world!")
(newline) 0)
>sees random undecipherable code on Sup Forums
>runs it in bash
10 print "Hello world"
20 play "CDEFGAB"
Hello, computer. Can you please write "Hello World" on the screen for me please? It's for an assignment. Thanks in advance.
Yours sincerely, Michael.