Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

pointer in C

#include <stdio.h>
int main()
{
   int* pc, c;
   
   c = 22;
   printf("Address of c: %p
", &c);
   printf("Value of c: %d

", c);  // 22
   
   pc = &c;
   printf("Address of pointer pc: %p
", pc);
   printf("Content of pointer pc: %d

", *pc); // 22
   
   c = 11;
   printf("Address of pointer pc: %p
", pc);
   printf("Content of pointer pc: %d

", *pc); // 11
   
   *pc = 2;
   printf("Address of c: %p
", &c);
   printf("Value of c: %d

", c); // 2
   return 0;
}
 
PREVIOUS NEXT
Tagged: #pointer #C
ADD COMMENT
Topic
Name
3+1 =