DEV Community

Cover image for Diving into C/sea🌊?
Mehreen Mallick Fiona
Mehreen Mallick Fiona

Posted on • Updated on

Diving into C/sea🌊?

Programming Language-C

Did you know that Dennis Ritchie created the programming language C in the 1970s? It's still widely used and considered highly influential in programming. Many developers consider C the "mother language" of all modern programming languages.

  • Let us begin with getting familiar with the datatypes that are dealt in C. There are two types of data types in C.

Image description

  • Depending on the declaration of a variable in C, there are two types of variables. They are as follows:
  1. Global variable: This variable is assigned outside the main() function of C.
  2. Local variable: This variable is assigned inside the main() function of C.
#include <stdio.h>
int r = 8; // global variable
int main() 
{
 int f =13; //local variable
}
Enter fullscreen mode Exit fullscreen mode

N.B: Every C statement ends with a semicolon ;

You can see that I used "include " in the above code. It's a mandatory header file library that allows us to work with input/output functions like 'printf()' for displaying our desired output.

#include <stdio.h>
int main() {
  printf(" Henlo World");
  return 0;
}
Enter fullscreen mode Exit fullscreen mode

Any code inside main()'s curly bracket is considered the notebook and it will be executed as per instruction. Here "return 0;" ends the main() function.

Top comments (2)

Collapse
 
ridwan805 profile image
Ridwanur Rahman

if we dont use the return function what will happen ?

Collapse
 
24mm profile image
Mehreen Mallick Fiona

I don't know.