C/Language Basics/Main
Содержание
A for loop inside main function
#include <stdio.h>
int main(void)
{
int x;
for(x = 1; x <= 100; x++)
printf("%d ", x);
return 0;
}
Const function in all c programs: main() function
#include <stdio.h>
int main() {
puts("program");
return(0);
}
Display Hello and your name
/* Display Hello and your name */
#include<stdio.h>
void main()
{
printf("Hello www.java2s.com!");
}
Display Hello: output String
/*Display Hello */
#include <stdio.h>
void main()
{
printf("Hello");
}
main function
#include <stdio.h>
int main(void)
{
printf("This is a short C program.");
return 0;
}
Program starts with main function
#include "stdio.h"
int main(void)
{
printf("This is a test");
return 0;
}
Simple string ouput
#include <stdio.h>
int main(void)
{
printf("hello");
/* printf("there"); */
return 0;
}