c - What does the prototype "const int* foo(int)" mean,especially in contrast to "int* foo(int)"?I understand the second only -
this question has answer here:
i know int* foo(int)
prototype means foo
function takes integer argument , returns pointer integer.but following mean?
const int* foo(int);
i tried reason failed.my book doesn't see stuff in library function prototypes.so please tell me means.
so value pointed returned address can't change via address (useful when foo() returns address of const).
const int* p2c = foo(int); *p2c=10; <-- "error"
Comments
Post a Comment