Contact: aviboots(AT)netvision.net.il
31,105 questions
40,777 answers
573 users
#include <stdio.h> int main(void) { int n = 100; const int *p; const int **pp; pp = &p; *pp = &n; printf("n = %d\n", n); printf("*p = %d\n", *p); printf("**pp = %d\n", **pp); return 0; } /* run: n = 100 *p = 100 **pp = 100 */
#include <stdio.h> int main(void) { int n; const int *p; const int **pp; pp = &p; *pp = &n; **pp = 13; // error: assignment of read-only location return 0; } /* run: */
#include <stdio.h> int main(void) { int n = 98; int *p; int * const *pp; pp = &p; *pp = &n; // error: assignment of read-only location ā*pā return 0; } /* run: */
#include <stdio.h> int main(void) { int n; int *p; int * const *pp; p = &n; pp = &p; **pp = 900; printf("n = %d\n", n); printf("*p = %d\n", *p); printf("**pp = %d\n", **pp); return 0; } /* run: n = 900 *p = 900 **pp = 900 */
#include <stdio.h> int main(void) { int n = 100; int *p; int ** const pp = &p; pp = &p; // error: assignment of read-only variable 'pp' return 0; } /* run: */
#include <stdio.h> int main(void) { int n; int *p; int ** const pp = &p; *pp = &n; **pp = 30; printf("n = %d\n", n); printf("*p = %d\n", *p); printf("**pp = %d\n", **pp); return 0; } /* run: n = 30 *p = 30 **pp = 30 */
#include <stdio.h> int main(void) { int n = 99; const int *p; const int * const *pp; p = &n; pp = &p; printf("n = %d\n", n); printf("*p = %d\n", *p); printf("**pp = %d\n", **pp); return 0; } /* run: n = 99 *p = 99 **pp = 99 */
#include <stdio.h> int main(void) { int n = 10; const int *p; const int ** const pp = &p; *pp = &n; printf("n = %d\n", n); printf("*p = %d\n", *p); printf("**pp = %d\n", **pp); return 0; } /* run: n = 10 *p = 10 **pp = 10 */
#include <stdio.h> int main(void) { int n; int *p; int * const * const pp = &p; p = &n; **pp = 88; printf("n = %d\n", n); printf("*p = %d\n", *p); printf("**pp = %d\n", **pp); return 0; } /* run: n = 88 *p = 88 **pp = 88 */