In c language if function data type is void and it returns 1, then it will give error or compile successfully | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

In c language if function data type is void and it returns 1, then it will give error or compile successfully

Void fun(){ int test=1; Return 1; }

15th Sep 2020, 4:20 PM
kishor pawar
kishor pawar - avatar
6 Answers
+ 5
Error : no ❌ Warning : Yes ✅ Here's proof👇 https://code.sololearn.com/cjDrpx8UcQl1/?ref=app
15th Sep 2020, 4:25 PM
Arsenic
Arsenic - avatar
+ 4
🐍Jasprit 🗡️ no bro it will not produce error, but it will give warning see arsenic's code
15th Sep 2020, 5:03 PM
kishor pawar
kishor pawar - avatar
+ 2
Try this #include <stdio.h> void func() { printf("executed without error"); // return 2; } int main() { func(); return 0; }
15th Sep 2020, 4:54 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
Arsenic thank you bro
15th Sep 2020, 4:30 PM
kishor pawar
kishor pawar - avatar
+ 1
Martin Taylor Thank you bro
16th Sep 2020, 6:12 AM
kishor pawar
kishor pawar - avatar
0
🐍Jasprit 🗡️ thank you bro
15th Sep 2020, 4:55 PM
kishor pawar
kishor pawar - avatar