C Programming - Lecture 3: The memory addresses of variables,
printf function, the first program
Variable memory address:
The variables that we use language such as C, no memory locations that most need to know is that there is not. However, at some point the government does not know the exact address. However, some time is needed. When using variables such as the scanf function address is used.Let us has a variable
int prime;There is no way to say it is now becoming a program that will run from any location, and it will be the memory. There are a number of things we are here for.
Let's address is 100.
Now we have to get the address of the variable name ayamaparasenda sign (&) if we intend to use & prime prime variables, such as location-kari.We'll use the pointer when it is better to take a look.
printf function
We know that the computer program is out of line 3. Input, output and processing. Now we look at the output.
We use language such as C printf function for output.
If one or more parameters of the function. The first of a string is mandatory. Strinta write the quotation mark.
printf ( ".... write something here ...");
The comma can write one or more expresssion. That is where we sit on the standard of Expressions type will write in the first string parameter.
printf ( ".... write something% d and% d and% d ...", a, 20, p + qr);
Here we've used% d is the number three explains how we used three standard computer chip, we would like to say these three places after the comma and three expresssion computer to write the standards.
Let Now we have some examples
Suppose we "Bangladesh" stinta'll print this. Then we would write
printf ( "Bangladesh");
If we want to write some numbers that are stored in a variable, then we can be helpful to write
int x;
x = 45;
printf ( "% d", x);
If kanosole (window period that we see on the monitor that karasola) we will be writing 45. Here is% d, we mean that we will have to write a number of variables in x.
We can write the number in a string. Suppose we want to write our standard p Price = 475, where 475 is variable, then write the
int p;
Wheather we want to write the sum of the two numbers, then it can be helpful to write
int a, b;
If the monitor shows
Sum of 10 and 20 is 30
Here are our three% d and they will be replaced with the value of the console, which show three times in a row with commas Ara likhechi a, b, a + b.
One thing to understand here is that if we do not diminish the value of the computer display, if the wrong work.
As
printf ( "Addition of this 2 thing is%d", a + b, b, a);
The output will be
Sum of 30 and 20 is 10
The value of% d in the first place (a + b), the second place of the% d value (b) and third place for the third value of% d (a) sit. As we have said.
Program
Now we have to write a Program
#include <stdio.h>
integer main ()
return zero;
}
1st line of this project include stetament. It tells kampailarake We'll use stdio library hours. This is laiberi the printf function. Then we wrote a block. And the name of a function that is usually to be main () to sign. Then {} marks the boundary of the two blocks will direct us. Printf function we have written in this block. Then, as the last line return 0; To write. We know why it's time to learn the function. They also need to know why before int main.
C language such as small/capital letter is important. Main text of the main places you can not.
You see it run.
printf function, the first program
Variable memory address:
The variables that we use language such as C, no memory locations that most need to know is that there is not. However, at some point the government does not know the exact address. However, some time is needed. When using variables such as the scanf function address is used.Let us has a variable
int prime;There is no way to say it is now becoming a program that will run from any location, and it will be the memory. There are a number of things we are here for.
Let's address is 100.
Now we have to get the address of the variable name ayamaparasenda sign (&) if we intend to use & prime prime variables, such as location-kari.We'll use the pointer when it is better to take a look.
printf function
We know that the computer program is out of line 3. Input, output and processing. Now we look at the output.
We use language such as C printf function for output.
If one or more parameters of the function. The first of a string is mandatory. Strinta write the quotation mark.
printf ( ".... write something here ...");
The comma can write one or more expresssion. That is where we sit on the standard of Expressions type will write in the first string parameter.
printf ( ".... write something% d and% d and% d ...", a, 20, p + qr);
Here we've used% d is the number three explains how we used three standard computer chip, we would like to say these three places after the comma and three expresssion computer to write the standards.
Let Now we have some examples
Suppose we "Bangladesh" stinta'll print this. Then we would write
printf ( "Bangladesh");
If we want to write some numbers that are stored in a variable, then we can be helpful to write
int x;
x = 45;
printf ( "% d", x);
If kanosole (window period that we see on the monitor that karasola) we will be writing 45. Here is% d, we mean that we will have to write a number of variables in x.
We can write the number in a string. Suppose we want to write our standard p Price = 475, where 475 is variable, then write the
int p;
Wheather we want to write the sum of the two numbers, then it can be helpful to write
int a, b;
If the monitor shows
Sum of 10 and 20 is 30
Here are our three% d and they will be replaced with the value of the console, which show three times in a row with commas Ara likhechi a, b, a + b.
One thing to understand here is that if we do not diminish the value of the computer display, if the wrong work.
As
printf ( "Addition of this 2 thing is%d", a + b, b, a);
The output will be
Sum of 30 and 20 is 10
The value of% d in the first place (a + b), the second place of the% d value (b) and third place for the third value of% d (a) sit. As we have said.
Program
Now we have to write a Program
#include <stdio.h>
integer main ()
return zero;
}
1st line of this project include stetament. It tells kampailarake We'll use stdio library hours. This is laiberi the printf function. Then we wrote a block. And the name of a function that is usually to be main () to sign. Then {} marks the boundary of the two blocks will direct us. Printf function we have written in this block. Then, as the last line return 0; To write. We know why it's time to learn the function. They also need to know why before int main.
C language such as small/capital letter is important. Main text of the main places you can not.
You see it run.



No comments: