3 votes 3 votes Point out the error : #include <stdio.h> void f(int*); int main() { int i=35,*z; z=f(&i); printf("%d",z); return 0; } void f(int*m) { return(m+2); } error in function call error in return statement error in argument of f() error in pointer initialization Programming in C tbb-programming-2 + – Bikram asked May 14, 2017 edited Aug 19, 2019 by Counsellor Bikram 502 views answer comment Share Follow See 1 comment See all 1 1 comment reply JashanArora commented Dec 27, 2019 reply Follow Share Void functions can't return values. You can, however, write return statements in them at the end to enhance user readability. https://stackoverflow.com/questions/22719242/returning-a-value-from-a-void-function 0 votes 0 votes Please log in or register to add a comment.
Best answer 7 votes 7 votes A void function cannot return a value though it can have a return statement. So, the answer is B. Samridhi Tyagi answered May 20, 2017 selected May 21, 2017 by Arjun Samridhi Tyagi comment Share Follow See all 8 Comments See all 8 8 Comments reply Show 5 previous comments val_pro20 commented Jan 6, 2019 reply Follow Share @joshi_nitish @Bikram even if u want to write a return statemnt for a void function(which is incorrect but lets suppose it compiles successfully ) then also return should be written like return; and not return(m+2);is it valid 0 votes 0 votes Sambhrant Maurya commented Jul 15, 2019 reply Follow Share z=f(&i); Is this correct? What does it mean? 0 votes 0 votes Bikram commented Aug 19, 2019 reply Follow Share https://gateoverflow.in/129778/test-by-bikram-2017-programming-test-2-18?show=130298#c130298 https://gateoverflow.in/129778/test-by-bikram-2017-programming-test-2-18?show=130312#c130312 0 votes 0 votes Please log in or register to add a comment.