how to write a data 10 in address location 0x2000
Answers were Sorted based on User's Feedback
Answer / vishnu
int main()
{
int *ptr;
ptr = (int *)0x2000;
*ptr = 10;
printf("%d", *ptr);
}
Is This Answer Correct ? | 5 Yes | 1 No |
The below line u can use for the question asked, provided
the address is not pointing to any OS memory, system files
or any location on ROM memory.
0x2000 is invalid address(Access voilation)in my system. So
I tried with the valid address 0x12FF70 to get the o/p.
main()
{
*(int *)(0x12FF70)= 20;
printf("%d \n",*(int *)(0x12FF70));
getch();
}
O/p would be 20.
Is This Answer Correct ? | 1 Yes | 0 No |
What is data types?
What should malloc() do?
Explain what is the heap?
What does nil mean in c?
program in c to print 1 to 100 without using loop
Explain what is a 'locale'?
What is 1d array in c?
What is the general form of function in c?
What is sizeof array?
what is the associativity of bitwise OR operator?
Do you know what is the purpose of 'extern' keyword in a function declaration?
What is use of pointer?