Simple Program for Change the Value of Constant Integer using...
On this page (5sections)
About this program
This is an example program in c pointer example programs. Read the concept first: C Pointers, then study the code and output below.
Poniter Syntax:
pointer_vaibale = &variable;
Simple Program for Change the value of constant integer Using Pointer
/* Simple Program for Change the value of constant integer Using Pointer in C*/
/* Print Pointer Address Program,C Pointer Examples */
#include <stdio.h>
int main() {
const int a = 100;
int *pt;
printf("Pointer Example Program : Change the value of constant integer\n");
pt = &a;
*pt = 200;
printf("\n[a ]:Value of A = %d", a);
return 0;
}
/*
* But It throws warning in GCC compiler
* change_const.c:12:6: warning: assignment discards 'const'
* qualifier from pointer target type [-Wdiscarded-qualifiers]
* */
Sample Output:
Pointer Example Program : Change the value of constant integer
[a ]:Value of A = 200
Related Pages
Learn the concept first, then study the code:
- C Programs — Browse all C Programs.
- C Pointers — Concept — pointers, addresses and dereferencing.
- Simple Pointer Example Program — More in c pointer example programs.
- Simple Program for Print address of Variable Using Pointer in C — More in c pointer example programs.