#include <stdio.h>
#include <conio.h>
main()
{
int a=10, *pa;
clrscr();
pa = &a;
printf(" Address = %u \n ", pa++ );
printf(" After pa++ Address = %u \n ", pa++ );
printf(" After one more pa++ Address = %u \n", pa );
printf(" Value of a = %d \n", *( pa - 2 ) );
getch();
return 0;
}
OUTPUT:
Address = 65524
After pa++ Address = 65526
After one more pa++ Address = 65528
Value of a = 10
ALSO READ:
-- Program To Understand Working Of Address Concept.
-- Program On Use Of Array & Pointer Concept Together.
-- Program On Pointers & 2 - Dimensional Array.
-- Program On Strings Into Array Of Pointers.
-- Program To Accept & Add Ten Numbers Using Pointers.
-- Program To Implement Minimum Spanning Tree Using Functions, Pointers & Structures.
-- Program To Implement 8 Queens Problem Using Arrays, Pointers & Functions.
-- Program To Implement Quick Sort Using Pointers, Functions & Arrays.
-- Program With Algorithm To Implement Bubble Sort Using Pointers.
-- Program To Implement Recursive Algorithm Using Pointers.
-- Program On Strings Into Array Of Pointers.
-- Program On Pointers & 2 - Dimensional Array.
-- Program On Use Of Array & Pointer Concept Together.
-- Program On Arithmetic Calculations Using Pointers.
-- Program To Add Two Numbers Using Pointers.
-- Program To Accept & Add Ten Numbers Using Pointers.
... Back To C Program Index.
Correct statement should be as below since the original value of pa is not changed as there are no assignments to it.
ReplyDeleteprintf(" Value of a = %d \n", *( pa ) );