How to access or modify the const variable in c ?

Answer Posted / mr.x

int main()
{
const volatile int no=10;
int *ptr;
ptr=(int *)&no;
*ptr=30;
printf("%d %d",no,*ptr);

return 0;
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of external class?

596


Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

603


What are multibyte characters?

644


How can I ensure that integer arithmetic doesnt overflow?

608


Can we replace the struct function in tree syntax with a union?

781






What are formal parameters?

660


how is the examination pattern?

1597


How do you generate random numbers in C?

658


Write a factorial program using C.

643


What is the explanation for cyclic nature of data types in c?

648


Write a C program in Fibonacci series.

635


Which header file is used for clrscr?

582


how could explain about job profile

1453


what will be the output for the following main() { printf("hi" "hello"); }

9332


the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none

647