gIe - papilon wrote:
> i started to learn C programming..
> 
> i had some question
> 
> example :
> 
> #include<stdio.h>    /* what the function of #include?*/
> 
> int main()           /* what's int main() purpose? */
> {
> printf('gf');
> return 0;            /* why must be return 0 ? not return 1 or x */
> }
> 
> thanks for your answer..

Others have mentioned to get a good book.  I agree.  The code above 
won't compile.

#include <stdio.h>

int main()
{
   printf("gf");

   return 0;
}

That will.  Also, learn to indent your code so it is readable. 
Seriously consider learning C++ instead of C.

#include includes a header file.  stdio.h contains the declaration for 
printf() (different from the _definition_!).

int main() is the entry-point to user code and is ANSI-Standard C/C++. 
Get yourself a copy of the Standard from the group website (highly 
recommended!).

The return value is used by some applications that could start your 
application (e.g. batch files and other scripts) to indicate success or 
failure.  Generally:  0 = success.  Non-zero = failure code.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to