Chap. 1 : Unit 6 : Sample C Program : Part 1

Till now we have seen syntaxes of various parts of general C Program like type declaration, operators and operands, keywords, constants etc. Now it is time to use all this concepts and write a simple program. 

First C language Program

Before we write our first C program we need to know menu of the turbo C compiler. 

usually icon is created or even you can create shortcut of turbo C compiler on the desktop. When compiler is opened you will get a blue screen with menu at the top. Turbo C compiler is most popular among programmers and so we are going to use the same. However as told earlier you can use any compiler as per your convenience. 

Select new from the file menu and you will get default workspace to write a C program. Either at the top of screen at the middle or at the right end corner at the top you will see default name of the file as noname.c. Also you can see line number and column number. 

Every program must be saved by the programmer before he or she starts writing the program. The file name should be small and meaningful. While saving the file, it should be saved in a proper directory created by the user. We will study all components of Menu in next few chapters when we need them. 

The C program is written inside the main function, however detailed study of function will be discussed later in the syllabus. 

Now following points need to be undestood and remembered as well. enlightened

  • We have to write main function in each C program,
  • Any C program can contain one and only one main function
  • Execution of any C program starts always from the main function
  • You need to write return type of main function before the main word
  • The whole C program is written in lower case alphabets
  • Each C statement is terminated by semi colon
  • However capital letters inside the print function are allowed as they become part of the string,
  • C program is a collection of functions 

Now we will write all those statements which we studied earlier in a proper way 

Access this framework with lot more stuff like C language MCQ, viva and interview preparation, Glossary, Solved Programs of C language etc. please register (log in) free on Register / Login

 

cenglishcppengcmarathi

Leave a Reply

%d bloggers like this: