PDA

View Full Version : A question about C



Dustin
12-30-2011, 10:49 AM
Which functions are allowed to have no (not even void) return value? Is main one of them? Constructor. No return type. No return statement. Main doesn't need a return value

General Doli
12-30-2011, 10:50 AM
whho the fuck are you

Dustin
12-30-2011, 11:01 AM
whho the fuck are you

You know its really rude to answer a question with a question. However, I am the son of the black dragon. Since he hardly posts it is my duty to uphold the Worldly duties of the black dragon.

rootbeer
12-30-2011, 11:01 AM
we dont talk about dragons

Dustin
12-30-2011, 11:03 AM
we dont talk about dragons
No one is.

rootbeer
12-30-2011, 11:27 AM
WW2NfAxwesQ&feature=g-vrec&autoplay=1

Dustin
12-30-2011, 11:33 AM
LIES!

Its not lies, being an underground 1337 hacker with Clay and our newly formed team " S3C5I0N 1337" You'll find that all talk about dragons can be done in the dragon sub forum which I just made

Dustin
12-30-2011, 11:41 AM
You just wait until Chronic Munchies hears about this outrage.

About what our super l33t team? Or the dragon sub forum, which I'm not sure how anyone could be mad at that...

maks
12-30-2011, 12:00 PM
VOID MAIN VOID HELLO WORLD

Dustin
12-30-2011, 12:04 PM
VOID MAIN VOID HELLO WORLD

Void is not a type of value a function returns. "void function();" mean "function" will not return any value

maks
12-30-2011, 12:06 PM
PRINTF \N

Dustin
12-30-2011, 12:13 PM
int main( int argc, char**argv ) {
int x = 5;
return 0;
}

fanfare
12-30-2011, 12:14 PM
jeez that vid made me laugh

maks
12-30-2011, 12:15 PM
#INCLUDE <CARE.H>

Array
12-30-2011, 01:50 PM
#define VAL_1X 42
#define VAL_2X VAL_1X, VAL_1X
#define VAL_4X VAL_2X, VAL_2X
#define VAL_8X VAL_4X, VAL_4X
#define VAL_16X VAL_8X, VAL_8X
#define VAL_32X VAL_16X, VAL_16X
#define VAL_64X VAL_32X, VAL_32X

int myArray[53] = { VAL_32X, VAL_16X, VAL_4X, VAL_1X };

reno
12-30-2011, 05:51 PM
math is more autistic than general dolloly

Blaze Master 420 #bout_it
12-30-2011, 07:33 PM
math is more autistic than general dolloly

#forreal #most_unfunny_poster #exposed #massive_ownage

General Doli
12-30-2011, 08:42 PM
#hashtags lol

General Doli
12-30-2011, 08:42 PM
If u want 2 fuck with me Whoever you are.... back the fuck away

jon
12-30-2011, 08:50 PM
Which functions are allowed to have no (not even void) return value? Is main one of them? Constructor. No return type. No return statement. Main doesn't need a return value

uh any function


#include <stdio.h>

foo()
{
printf("foo");
}

main()
{
foo();
printf("bar\n");
}


jon@wroth:~/sandbox$ gcc -Wall -ansi -pedantic idiot.c
idiot.c:4: warning: return type defaults to 'int'
idiot.c: In function 'foo':
idiot.c:6: warning: control reaches end of non-void function
idiot.c: At top level:
idiot.c:9: warning: return type defaults to 'int'
idiot.c: In function 'main':
idiot.c:12: warning: control reaches end of non-void function
jon@wroth:~/sandbox$ ./a.out
foobar


and there are no constructors in C

jon
12-30-2011, 08:51 PM
and they do have a return value even though you are allowed to skip its declaration, as you can plainly see from the warnings, and that default return value is int

maks
12-30-2011, 08:55 PM
I'll foo your bar