[ create a new paste ] login | about

Link: http://codepad.org/CPtNE7LS    [ raw code | output | fork | 5 comments ]

C, pasted on Apr 3:
1
2
3
4
5
#include<stdio.h>
void main()
{
    printf("My first C program!");
}


Output:
1
My first C program!


Create a new paste based on this one


Comments:
posted by raviiitianxxx26@gmail.com on Jul 8
Y we are using # what does this mean??
reply
posted by JKCP42 on Sep 22
Hi, I learned the following from highbrow.com:
See the first line? The hash (#) symbol does not make it a Twitter hashtag! This line tells your computer to include something called stdio.h at the beginning of this code. So, when this code is executed, all the content present in a file called stdio.h is attached at the beginning of your program.

This particular file—stdio.h, or the Standard Input/Output Header File—contains the things you need to be able to use your program to accept an input and display an output. It is sort of like having a vocal cord. Without it, you cannot speak. Just the same way, if you don't have stdio.h included in your programs, they will not be able to display any output (or accept any input).
reply
posted by prh on Oct 15
What is the meaning of void main ()
reply
posted by crazyturtle90 on Jan 25
In general, void main() is a function.
The word before the method name (main) refers to what is being returned at the end of the function call. In this case, it is void which means that nothing is being returned. Otherwise you can add additional types to be returned from a method.

main, as mentioned on top, refers to the method name. This is the main method which starts everything!
reply
posted by BootCamp on Nov 7
he hash (#) symbol does not make it a Twitter hashtag! This line tells your computer to include something called stdio.h at the beginning of this code. So, when this code is executed, all the content present in a file called stdio.h is attached at the beginning of your program.
reply