When talking about pointer, Pointer is one of the most important topic of C programming language.
There is many use of pointer in programming. But this article focus only the basic of the pointer in C programming language.
This article is for those:
1. Who wants to know the basics of Pointer in c language.
2.Who are looking to understand pointer with examples.
Pointer is a variable. Pointer holds memory address. Whose memory address?
Pointer holds the memory address of an object.
How to declare:
data type *variable_name;
like, int *p
float *q;
there are two pointer operators: 1. & and 2. *
&: It means the address of the variable.
* : It means the value of the address.
An example can explain the basics of these two operators:
#include <stdio.h>
int main()
{
int *x,v;
v = 10; /* variable v is given a value 10 */
x = &v; /* x is point to the address of v */
/* as address of v has value of 10 */
/* So v returns 10 */
printf ("%d", *x);
return 0;
}
Here we can see that, & operator holds the memory address.
* operator points to the value of that memory address.
There is many use of pointer in programming. But this article focus only the basic of the pointer in C programming language.
This article is for those:
1. Who wants to know the basics of Pointer in c language.
2.Who are looking to understand pointer with examples.
Pointer is a variable. Pointer holds memory address. Whose memory address?
Pointer holds the memory address of an object.
How to declare:
data type *variable_name;
like, int *p
float *q;
there are two pointer operators: 1. & and 2. *
&: It means the address of the variable.
* : It means the value of the address.
An example can explain the basics of these two operators:
#include <stdio.h>
int main()
{
int *x,v;
v = 10; /* variable v is given a value 10 */
x = &v; /* x is point to the address of v */
/* as address of v has value of 10 */
/* So v returns 10 */
printf ("%d", *x);
return 0;
}
Here we can see that, & operator holds the memory address.
* operator points to the value of that memory address.
No comments:
Post a Comment