The C Programming Language Structure with C Language data types
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
- Statements & Expressions
Print the words “Hello World”:
int main ( )
printf ("Hello, World! \n")
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 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:
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|