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
Thread: A question about C
Results 1 to 22 of 22
Hybrid View
-
12-30-2011
-
-
-
-
-
-
-
-
12-30-2011
VOID MAIN VOID HELLO WORLD
-
-
-
12-30-2011
int main( int argc, char**argv ) {
int x = 5;
return 0;
}
-
-
-
- Join Date
- Dec 2011
- Location
- Array
- Posts
- 7
12-30-2011#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 };
-
12-30-2011
math is more autistic than general dolloly
disappointing you is getting me down
-
big shit poppen lil shit droppen smoken mad dank out of a 6 foot bong errday bitch you is so ugly change yo face and maybe you can ride with a real mac og you ugly stank skuttle bucket god damn blowne on that mad og mango berry kush high as fuck put a gun in my mouth because i like the way that shit tastes #holla #bout it #420 #weed #yaboi
-
General Doliking steveyos12-30-2011
If u want 2 fuck with me Whoever you are.... back the fuck away
-
-
12-30-2011
uh any function
Code:#include <stdio.h> foo() { printf("foo"); } main() { foo(); printf("bar\n"); }
Code: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
-
12-30-2011
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
-
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)