C Foundation

What is C? C Compiler Installation C Extensions C Compiler C Interpreter C Program Structure

C Basics

C Keywords C Data Types C Identifiers C Variables C Constant C Escape Sequences C Constant and Volatile C Typecast

Operators

What is Operator C Comma Operator C Arithmetic Operators C Relational Operators C Logical Operators C Bitwise Operators C Conditional Operators C : : Operator C Operator Priority

Basic IO's

Basic IO's C Formatted Functions C Unformatted Functions C Common Functions

Control Statements

What is Control Statement C if Statement C if else Statement C Nested if Statement C Else if Statement C Break Statement C Continue Statement C Switch Statement C Goto Statement

Looping

What is Control Loop C for Loop C Nested for Loop C while Loop C Nested while Loop C do while Loop C Nested do while loop

Functions

What is Function C User Defined Functions C Recursion C Passing Parameters

Scope

Scope C Local Scope C Global Scope

Storage Classes

What is Storage Class C Auto C Extern C Static C Register

Array

What is Array C One Dimensional Array C Two Dimensional Array C Multi Dimensional Array C Arrays Of Strings

String

What is String C String Functions

Pointer

What is Pointer C Pointers Arithmetic C Pointer to Pointer C Pointers and Arrays C Pointers and Strings C Pointer to Functions Void Pointers Null Pointers C Null and Void Pointer

Structure

What is Structure C Struct within Struct C Array within Structure C Pointer to Structure C Structure and Function C Enum C Bitfield Structure C Type def

Union

What is Union

Files

What is File C read a file C write a file C File Handling C Error Handling C Low Level Disk I/O C Other file functions

Memory Allocation

What is Memory Allocation C Malloc() C Calloc() C Free() C Realloc() C Coreleft()

C Reference

All ASCII Code Basic C Questions

C Interview

C Interview Sets All Star Patterns All Number Patterns All Alphabet Patterns All Series Patterns
The ones who are crazy enough to think they can change the world are the ones who do.
- Steve Jobs

C Basic Program

Basic Program

Here we starts with very basic C program

How Interpreter Works
basicprogram.c
#include <stdio.h> //header file section
int main() //main section
{
printf("I will display "); /*Output statement*/
return 0; /*Program ends here*/
}
  • I will display

Header File Section

C contains many inbuilt functions which are all predefined by its appropriated header files. Here we used printf() inbuilt function which is defined in stdio.h header files or otherwise said to be library. The file should be included by using #include directive e.g.) #include<stdio.h>.

Main Section

Every C program must contain main() function which tells the compiler that the program starts from here. Empty paranthesis must after every main in C programming. main function cannot have any parameters.

Executable Section

Executable section contains single (or) set of statement for example printf is an executable statement.

8 Programming Rules In C

  • Rule 1: All statement should be written in lowercase letters.
  • Rule 2: Uppercase letter can be used only for symbolic constants.
  • Rule 3: Blank spaces may be inserted between the words. This improves the readability of statements.
  • Rule 4: Blank spaces should not be allowed while declaring variables, constants, keyword, function.
  • Rule 5: Programmer can write the statement anywhere between the "2 braces".
  • Rule 6: Programmer can write one or more statement in one line, separating that by semicolon (;).
  • Rule 7: Opening and closing "braces" must be balanced.
  • Rule 8: Program must contain a main function.

Report Us

We may make mistakes(spelling, program bug, typing mistake and etc.), So we have this container to collect mistakes. We highly respect your findings.

Report

We to update you