How to modify constant variable in C

1 Answer

0 votes
#include <stdio.h> 
 
int main(int argc, char **argv) 
{ 
    const int n = 5;
    int *p = &n; // not recommended
    
    *p = 13;
    
    printf("%d",n);
     
    return(0);
}
 
 
/*
 
run:
 
13
 
*/

 



answered May 5, 2017 by avibootz

Related questions

1 answer 220 views
1 answer 282 views
1 answer 61 views
2 answers 86 views
1 answer 163 views
2 answers 147 views
147 views asked Apr 23, 2022 by avibootz
2 answers 149 views
149 views asked Sep 17, 2021 by avibootz
...