The session resources are as follows:
الله ينور يا لينكساوي باشا
Linux Let's Free The World
حصل معايا المشكلة دي وانا بجرب المثال بتاع switch.c عملته compile بالأمر ده
gcc -o switch.o switch.c
وكانت دي هي النتيجة
switch.c: In function ‘main’: switch.c:3: warning: return type of ‘main’ is not ‘int’
يا ريت حد يفهمني هي ايه مشكلة void main() وليه لازم يكون ال return int;
يا ريت لو في حد ذاكر يقولنا :)
والسلام ختام
مسح كلمة void او استبدالها ب int حل المشكلة
وسبب المشكلة دي مشروح هنا
Why would you replace void by int if ur not returning anything ??? you should also add "return 0;" to the end of the main function
Michael behman
main's return is used to indicate the exit state of the software. in unix that is a requirement any process gives an exit code on it's termination.
by examining the exit code you can tell if the program ran successfully or it faced some problems and which kind of problem exactly.
we return 0 as the default behavior because exit code 0 means program ran successfully.
GCC complains because this is actually part of the C99 standard, which means void main is technically incorrect.
for more details about exit status check the man page for exit(3)
Alaa
husband of the Grand Waragi Master
عاده بيعتبر good practice انك تخلي ال main ترجع int. عشان تتعود و انت بتكتب الكود انك ترجع exit/return value للسيستم.
عشان كده gcc مقالش ان ده غلط ، الراجل بيحذرك بس، ده أسمه عك :D
Comments
الله ينور
الله ينور يا لينكساوي باشا
Linux Let's Free The World
warning: return type of ‘main’ is not ‘int’
حصل معايا المشكلة دي وانا بجرب المثال بتاع switch.c عملته compile بالأمر ده
gcc -o switch.o switch.c
وكانت دي هي النتيجة
switch.c: In function ‘main’:
switch.c:3: warning: return type of ‘main’ is not ‘int’
يا ريت حد يفهمني هي ايه مشكلة void main() وليه لازم يكون ال return int;
يا ريت لو في حد ذاكر يقولنا :)
والسلام ختام
Linux
Let's Free The World
حل المشكلة
مسح كلمة void او استبدالها ب int حل المشكلة
وسبب المشكلة دي مشروح هنا
Linux
Let's Free The World
the rest of the solution
Why would you replace void by int if ur not returning anything ??? you should also add "return 0;" to the end of the main function
Michael behman
main's return is used to
main's return is used to indicate the exit state of the software. in unix that is a requirement any process gives an exit code on it's termination.
by examining the exit code you can tell if the program ran successfully or it faced some problems and which kind of problem exactly.
we return 0 as the default behavior because exit code 0 means program ran successfully.
GCC complains because this is actually part of the C99 standard, which means void main is technically incorrect.
for more details about exit status check the man page for exit(3)
Alaa
husband of the Grand Waragi Master
عاده بيعتبر good
عاده بيعتبر good practice انك تخلي ال main ترجع int. عشان تتعود و انت بتكتب الكود انك ترجع exit/return value للسيستم.
عشان كده gcc مقالش ان ده غلط ، الراجل بيحذرك بس، ده أسمه عك :D