i recently came across a code which was like
if the function returns an int, what does this code do. can we have function returning a value and be on the right hand side of "="?Code:func1() = 0;
where would such code be useful?
thanks
sedy
i recently came across a code which was like
if the function returns an int, what does this code do. can we have function returning a value and be on the right hand side of "="?Code:func1() = 0;
where would such code be useful?
thanks
sedy
Before that: are you sure you saw that line of code in a C, not a C++, program?Originally Posted by sed_y
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
C++ is a different language than C. Do you actually want to know about C++, or stick with C?
Then he must've seen it in C++ code.
@sed_y : This might be a useful read.
It will have been a C++ pure virtual function declaration.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
hi all,
It was a C++ code. but i thought,
C might have it too. thats why i posted it.
sedy
The closest thing in C would be a function pointer:But there is no actual () on the assignments.Code:void foo( void ); void bar( void ); ... void (*baz)( void ) = foo; baz(); bar = bar; baz(); baz = NULL;
Quzah.
Hope is the first step on the road to disappointment.
Possible, but it would then be missing the return type.Originally Posted by iMalc
Next time declare that this is not C, but you want to know if it is valid in C. Actually, if you wanted an explanation, it would have been better to ask for it in the C++ programming forum, with an additional question of whether it applies to C too.Originally Posted by sed_y
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)