Int main()

>int main()
>return 0

What did he mean by this?

Other urls found in this thread:

ctyme.com/intr/int-80.htm
twitter.com/NSFWRedditVideo

He meant the program had finished successfully with no errors. Otherwise that program returned a non-zero value.

the function main expects a return value of type integer when it finishes execution. return 0 basically means everything happened as expected, and is a value that you can check to make sure it did. anything other than 0 probably means something bad happened.

Return 0 as the result to the calling program.

main:
mov ax 4c00h
int 21h


what did he mean by this?

Some system call

movl $1, %eax
movl $0, %ebx
int $0x80

what did he mean by this?

See

>please explain what this code does
>it uhhhhhh like it does something

>"what did he mean by this" = "please explain"
no, take your silly memes back to Sup Forums

Your response is meaningless either way. If you treat it as a proper question, you have to reply properly. If you treat it as a worthless meme, then there is no need to respond.

If my response is meaningless, then your response to my response is meta-meaningless.

meta is a lie

wtf? Why did you initialise your soundblaster? Or am I reading this wrong...

ctyme.com/intr/int-80.htm

Does anyone here use return as a substitute for global scoping?

>ctyme.com/intr/int-80.htm
>Int 80 - Linux - SYSTEM CALLS
>Why did you initialise your soundblaster?

>Or am I reading this wrong
what did he mean by this?

>what did he mean by this?
what did he mean by this?

You can't use return as a substitute for global scoping, so no, no one here does that.

Tying to learn C++

Do a lot of Ruby and JS right now.

I just bought "The C++ Programming Language 4th Edition"

Did I make the right choice?

what did he mean by this?

what did you mean by this?

i don't know

what did she mean by that?

...

I do all the time in python

def kfkkfkfkfkf():
name = 'fag'
print("you'er a fag")
return fag
def jfjfjjfjfjfjjfjfjfj():
name = kfkkfkfkfkf()
print(name)
jfjfjjfjfjfjjfjfjfj()

People in this thread say if main returns anything but 0, it's not good and means something went wrong.
But:
It will always return 0 because you wrote return 0;

How can it return anything else?

Your code is broken, and even if was not, it doesn't demonstrate return as a substitute for global scoping.

Cosmic rays flipping the bits

Memory corruption on levels unheard of

If during the execution of your program you want to notify whoever started your program that something went wrong, for example, you wanted to write a configuration, file to disk but was denied by OS, you return a non-zero value from main. If you yourself don't return that value, no one will for you (apart from some very specific cases).

So, to answer your question, this program always returns 0 because the programmer decided that nothing can go wrong in it.

He should return 5 because he's lol so random

That's actually more acceptable that returning 5 as a result of min function. At least you can document it and it won't fuck up anything for user who reads documentation.

$ cat retval.cpp
int main() {
return 69;
}
$ g++ retval.cpp
$ ./a.out
$ echo $?
69

???????????????????

Ah, the good old 69 - mount error.