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 r the cpu registers r ther?
what is the use of #pragma pack, wer it is used?
What is external variable in c?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it.
how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ?
What is the purpose of realloc()?
What is non linear data structure in c?
What is void main ()?
what is the difference between arrays and linked list
26 Answers MAHINDRA, Tech Mahindra, Wipro,
How can a program be made to print the line number where an error occurs?
How can I manipulate strings of multibyte characters?
Reverse the part of the number which is present from position i to j. Print the new number.[without using the array] eg: num=789876 i=2 j=5 778986