Explain Pointers in C with Examples? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Explain Pointers in C with Examples?

C Programming

18th Nov 2020, 4:07 PM
Bhat Muzamil
2 ответов
+ 2
A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location. Like any variable or constant, you must declare a pointer before using it to store any variable address. example: #include <stdio.h> int main () { int var = 20; /* actual variable declaration */ int *ip; /* pointer variable declaration */ ip = &var; /* store address of var in pointer variable*/ printf("Address of var variable: %x\n", &var ); /* address stored in pointer variable */ printf("Address stored in ip variable: %x\n", ip ); /* access the value using the pointer */ printf("Value of *ip variable: %d\n", *ip ); return 0; }
18th Nov 2020, 4:09 PM
The future is now thanks to science
The future is now thanks to science - avatar
18th Nov 2020, 4:19 PM
NavyaSri
NavyaSri - avatar