A Simple C Program That Displays Text Line

Computer programming, a set of instruction or statements that control computer's data. It is the comprehensive process that leads from an original formulation of a computing problem to executable programs.

In my previous hub i have shared a little bit about C and C++. Here, I am again going to share a small hub. This hub explains a simple code which is written by C program. Basically it's a program for very beginner who just start to learn C or want to learn C program. I hope it might be useful.

So, you already know the question is "Write a C Program Which Displays A Single Text Line?"

We are going to display/output "Today Is Sunday"

Source

Here is the Code

#include <sdtio.h>	 /*this is header file*/
int main()	 /* function main begins executable*/
{
printf ("This Is Sunday\n");	/* do the action of display*/
return 0;	 /* include that program ended successfully*/
}
5 out of 5 stars from 1 rating of This Hub

Description Of This Program

You might have noted the code or program that i have given above. But if you don't understand the code you can not be good programmer. So we need definition or description of that code so that we can catch the meaning of the code. Here i shortly describe every part of the code, just read carefully.

#include <stdio.h>

This is the header file where # is called as "preprocessor", "include" gives command to include something and <stdio.h> is the library. It tells computer to load contents of a certain file and links with library. "stdio" stands for "standard input output".

int main()

C program contains one or more functions, exactly one of which must be the 'main' function. The main function is where a program starts execution. 'int' means that 'main' returns an integer value. The bodies of all functions must be in braces ({ })

printf("Today Is Sunday\n");

printf is the command for display/output. It displays what is been written in between coatation sign (" "). Here '\n' is the escape character which means starting of a new line.

return 0;

A way to exit a function. It means that the program terminated normally, right brace '}' indicate end of the 'main' function.

/*

This is comment sign. If the programmer wants to put comment on that code he can use this sign first to write it down.

Output of Code
Output of Code

Conclusion

A computer program is the key to the digital city: If you know the language, you can get a computer to do almost anything you want. The C programming language is also a high-level programming language. C programming allows users to create instructions for a computer to follow. It has been told that C is one of the most widely used programming languages of all time. Between 1969 and 1973, the primary development of C occurred by Dennis Ritchie and Brian Kernighan at AT&T Bell Labs.

No comments yet.

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working