0 votes 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 asked Jun 4, 2016 shekhar chauhan 573 views answer comment Share Follow See all 5 Comments See all 5 5 Comments reply Show 2 previous comments Lokesh . commented Jan 18, 2017 reply Follow Share but it is a constant pointer ...once initialized it can't point to another memory location 0 votes 0 votes Pranav Kant Gaur commented Jan 19, 2017 i edited by Pranav Kant Gaur Jan 19, 2017 reply Follow Share 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 votes 0 votes Gurdeep Saini commented Nov 13, 2018 reply Follow Share 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 votes 0 votes Please log in or register to add a comment.
0 votes 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 See all 2 2 Comments reply vaishali jhalani commented Nov 12, 2016 reply Follow Share Why it is not showing error as pointer is constant and we are assigning a different value to it... 1 votes 1 votes Sushant Gokhale commented Jan 20, 2017 reply Follow Share Getting error on CodeChef for C99 strict 0 votes 0 votes Please log in or register to add a comment.