PDA

View Full Version : A question about C



Dustin
12-30-2011, 09: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, 09:50 AM
whho the fuck are you

Dustin
12-30-2011, 10: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, 10:01 AM
we dont talk about dragons

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

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

Dustin
12-30-2011, 10: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, 10: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, 11:00 AM
VOID MAIN VOID HELLO WORLD

Dustin
12-30-2011, 11:04 AM
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, 11:06 AM
PRINTF \N

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

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

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

Array
12-30-2011, 12: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, 04:51 PM
math is more autistic than general dolloly

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

#forreal #most_unfunny_poster #exposed #massive_ownage

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

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

jon
12-30-2011, 07: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, 07: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, 07:55 PM
I'll foo your bar