The C Programming Language Structure with C Language data types:
Programming is an art because of its creativity and versatility. A c programming language allows us to think about minimum program structures in order that we will take it as a reference in future topics.
C Language Hello World Example:
- Pre-processor Commands
- Functions
- Variables
- Comments
- Statements & Expressions
Print the words “Hello World”:
#include
int main ( )
{
printf ("Hello, World! \n")
return O;
}
Explain above program:
- The line of program #include can be a preprocessor command, which asks the C compiler to add the stdio.h file before moving on to the compile.
- Line int main () is that the main function where program execution begins.
- Next to main () line. This is the basic function where program execution begins.
- Line /*…*/ ignored by the compiler and it’s been put to feature additional comments in so such lines are called comments within the program.
- printf(..) is another function available in C that causes the message Hello, World! displayed on the screen.
- Last line return 0; because program terminates main () function and returns 0.
Comments:
Comments are like helping text in your C program and that they are ignored by the compiler. they begin with /* and terminates with the characters */ as shown below:
/* My first comment with codeboks.com*/
Whitespace in C Program:
The whitespace is the turn used in C to describe spaces, tabs, new posts and comments.
Whitespace separates one a part of a press release from another and enables the compiler to spot where one element during a statement, like int, ends and therefore the next element begins. Therefore, within the following example:
Int name;
There must be at least one white character between int and age to be ready to distinguish the compilers. In the opposite direction, inside the following example:
Sum = 4+3;
No whitespace characters are necessary between sum and =, or between = and a couple of, although you’re liberal to include some if wish for readability purpose.
C Language data types:
No. | Types | Storage Size | Value Range |
---|---|---|---|
1 | char | 1 byte | -128 to 127 or 0 to 255 |
2 | Unsigned char | 1 byte | 0 to 255 |
3 | Signed char | 1 byte | -128 to 127 |
4 | Int | 2 or 4 byte | -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647 |
5 | unsigned int | 2 or 4 byte | 0 to 65,535 or 0 to 4,294,967,295 |
6 | Short | 2 byte | -32,768 to 32,767 |
7 | unsigned short | 2 byte | 0 to 65,535 |
8 | Long | 4 byte | -2,147,483,648 to 2,147,483,647 |
9 | unsigned long | 4 byte | 0 to 4,294,967,295 |
10 | float | 4 byte | 1.2E-38 to 3.4E+38 |
11 | double | 8 byte | 2.3E-308 to 1.7E+308 |
12 | long double | 10 byte | 3.4E-4932 to 1.1E+4932 |
Also: Basic Concepts of Programming Languages C++ Programming Examples
Pingback: Best Top 5 Programming Languages demand in 2021
I have read so many articles or reviews concerning blogger lovers but
this paragraph is genuinely a pleasant piece of writing, keep it
up.
It’s in reality a nice and helpful piece of info.
I’m satisfied that you shared this helpful information with us.
Please keep us up to date like this. Thank you for sharing.
Pingback: Write an Assembly Language Program to Display a String
Pingback: Binary Search Algorithm in C++ with Source Code
Pingback: Arizona State University Computer Science Ranking