Answers for "change value of const in c"

C
0

c change value of const

#include<stdio.h>
#include<stdlib.h>
int main()
{
    const int var = 10;
  
    int *ptr = &var;
    *ptr = 12;
  
    printf("var = %dn", var);
  
    return 0;
}
Posted by: Guest on September-14-2021
0

const in c

int *ptr; // *ptr is an int value
int const *ptrToConst; // *ptrToConst is a constant (int: integer value)
int * const constPtr; // constPtr is a constant (int *: integer pointer)
int const * const constPtrToConst; // constPtrToConst is a constant (pointer)
                                   // as is *constPtrToConst (value)
Posted by: Guest on August-25-2021

Code answers related to "C"

Browse Popular Code Answers by Language