Saturday, May 31, 2025

Introduction to C Language

 

 History of C language.

The C Language was created by Dennis Ritchie at the laboratories in 1972. The UNIX system was developed in C Language between 1977 and 1979. In 1983 the American National Standards Institute (ANSI) to amend and standardized the language. In 1972 and still it is rank 2 on the TIOBE Index and 4 in IEE Spectrum Index. C was firstly developed for the UNIX Operating System. C is also called the mother of modern programing languages.










What are the key features of C programing  that makes it unique?

  • Pointer mechanism.
  • Functions.
  • Extensible.
  • Library functions.
  • Compiled language.

Applications of C Language.

  • Operating Systems.
  • Language Compilers.
  • Assemblers.
  • Databases.
  • Utilities.
  • Text Editors.

Structure of C language.

  • Documentation.
  • Preprocessor Section.
  • Definition.
  • Global Declaration.
  • Main () Function.
  • Sub Program.









Example;

#include <stdio.h>

int main(){
  printf("Hello World!);
  return 0;
}


C New lines

  • New lines are indicated by \ n.
  • New line is an escape sequence.

Example;

#include <stdio.h>

int main(){

 printf("Hello World!\n");

printf("I love learning C language.");

return 0;

}


C Comments

  • C comments prevent execution when testing.
Single line comments
  • Single line comments start with (//).
  • For short comments we use single line comments.
Example 1;

#include <stdio.h>

int main(){

// This is a comment
printf("Hello World!");

return 0;

}


Example 2;

#include <stdio.h>

int main(){

printf("Hello World!");// This is a comment.

return 0;

}

Multi-line comments
  • Multi-line comments start with /* ends with */.
  • For long comments we use multi-line comments.
Example;

#include <stdio.h>

int main(){

/* The code below print  the words Hello World! to the screen , and it is amazing*/
printf("Hello World!");

return 0;

}












No comments:

Post a Comment

Introduction to C Language

   History of C language . The C Language was created by Dennis Ritchie at the laboratories in 1972. The UNIX system was developed in C Lang...