Programming .

in #steemiteducation7 years ago

Write comments

Many people think of the title, write comments on Facebook. What is the thing on C programming again?

The incident is sometimes written in a big program, what are you doing? So that you can remember later what happened. It is not part of the program. Just to keep you in mind or easy to understand later. But it's a compiler! Is there any place to write separately here?

Actually do not need to write separately. 😛As / * After that I did not write anything you would not compile * / until. This is called the comments of programming languages.


#include<stdio.h>

main()

{

/*we will print now */

printf(“I am a C programmer”);

}

When you compile the line, we will see that the line will not be output.


Conversion Character

To understand the conversion, understand the strings. In a word, string is the sum of the characters or words.

A conversion character is a place commander that we can put a string in. We will now see a program using Conversion Character.

main()

{

printf(“%s is a good boy\n”);

}

What is understood from this line is that a word or a text is a good boy. Now if we come up with a new string,

main()

{

printf(“%s is a good boy\n”, “Rahim”);

}

Now the output will come like Rahim is a good boy.

That is to say that the change in% s is Rahim . If there is another% s what will be on this line?

main()

{

printf(“%s is a good boy %s \n”, “Rahim”, “I have ever seen”);

}

I can never seen the second% s in the output

Say good % s is only for string. For text, wards etc. But maybe we're using numbers?

main()

{

Printf(“Bangladesh won by %d runs”, “67”);

}

When it comes to output, Bangladesh won by 67 runs

% d This only applies to integer numbers. Here's the decimal, but the result will be wrong.

If we want to keep decimal number, then write % f .

main()

{

Printf(“Bangladesh won by %f runs”, “67.5”);

}


Data type

Data types are required according to data values ​​for variables declaration. The four types of data type are basically.

1.char
2.int
3.float
4.double

Char:

To work with character type or alphabet in C programming, char is used to type char data type for variable declaration. The char keyword is used to declare variables of char type.

Example: char ch;

int:

An int data type is used to declare an int type variable to work with the whole number. Int keyword is used to declare variable type int.

Example: int x;

float:

To work with decimal numbers, float data type is used to declare variable type variables. Float type is used to declare variable type of float.

Example: float and;

double:

To work with a large number of decimal marks, we use the double data type to declare variable type of variable. Double type is used for double type variable declaration.

Example: double z;


Data type declare

Data declaration refers to declaring variables in certain data types. Variable declaration format of a data type

DataTypeName VariableName;

Example: Char ch; int x;

Variable:

Variable refers to the location or address of the memory location. When working with data in the program, we have to use a variable for each data. Their variables can be changed because of their variables or variables.

In other words, it is possible to keep only one data at any time in any variable. There are roughly five types of variables used in C language.

1.Numeric variable
2.Array variable
3.Pointer variable
4.String variable
5.Custom Variable.

Variable Declare:

To work with any data in the program, first to declare the variable with the data type ; for the C program, all the variables at the beginning of the main () or other functions; It has to declare data type.

However, it is to be remembered that two or more variables can not be declared in the same function.

Example of Variable Declaration

main()

{

int age;

float marks;

}

Now a whole number for ages and a decimal fraction can be used for marks.

age=25;

marks=23.8;

See the program below;

#include<stdio.h>

int main()

{

int age;

age=27;

printf(“I am %d years old”, age);

}

What is the output? Get the error out of error.😉

Logomakr_1UJIm4.png

Coin Marketplace

STEEM 0.19
TRX 0.12
JST 0.027
BTC 60441.03
ETH 3344.59
USDT 1.00
SBD 2.48