0 0 votes #include <stdio.h> int main() { int i = 10; int *const p = &i; fd(&p); printf("%d\n", *p); } void fd(int **p) { int j = 11; *p = &j; printf("%d\n", **p); } Programming in C programming-in-c pointers + – shekhar chauhan 1.3k views answer comment Share Follow Print See all 5 Comments 5 5 Comments reply Show 2 previous comments Lokesh . commented Jan 18, 2017 reply Follow flag but it is a constant pointer ...once initialized it can't point to another memory location 0 0 replyShare Pranav Kant Gaur commented Jan 19, 2017 i edited by Pranav Kant Gaur Jan 19, 2017 reply Follow flag This program runs only if we enable permissive flag(ignoring invalid datatype conversion from int*const* to int**). I think once we typecast this location to be of non-constant type(through explicit invalid conversion) then we can edit the content pointed to by this pointer, which is why I think output comes out to be 11,11. 0 0 replyShare Gurdeep Saini commented Nov 13, 2018 reply Follow flag https://ideone.com/E2oGjC giving 11 0 output on ideone also on onlinegbd compiler but when run on the geekforgeeks complier giving 11 11 output with some warning please someone expalain those warning and also right solution 0 0 replyShare Please log in or register to add a comment.
0 0 votes output is 11 11 Don't you worry answered Jun 4, 2016 Don't you worry comment Share Follow See all 2 Comments 2 2 Comments reply vaishali jhalani commented Nov 12, 2016 reply Follow flag Why it is not showing error as pointer is constant and we are assigning a different value to it... 1 1 replyShare Sushant Gokhale commented Jan 20, 2017 reply Follow flag Getting error on CodeChef for C99 strict 0 0 replyShare Please log in or register to add a comment.