Basic structure

C programming requires that you adhere to a fundamental framework. This is how it can be reduced.

  • Preprocessor commands
  • Functions
  • Variables
  • Statements
  • Expressions
  • Comments

Preprocessor instructions

  • Because we are utilising some of the commands or codes from this file, pre-processor commands instruct our software that the file name must be included before it can be executed.They provide a programme new features.

Example:

#include <math.h>
  • To use some specialised functions, such as power and absolute, we require math.h. We include them into our applications using the syntax #includefilename.h>.

Syntax

The basic C programming structure and how it is applied are demonstrated in the example below.

#include <stdio.h>
int main()
{
    printf("Hello World!");
    return 0;
}

The pre-processor command in this case includes the header file stdio.h in the first line.Spaces and blank lines are ignored in C. The main() function is present and must always be present.A print statement comes first, followed by a return statement.In C, a semicolon must be used to conclude every sentence.Ensure that the function’s return type and return statement are the same.

Shubhajna Rai
Shubhajna Rai

A Civil Engineering Graduate interested to share valuable information with the aspirants.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.

    StudentProjects.in