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 happens if header file is included twice?
write a program of palindrome(madam=madam) using pointer?
Why c is called top down?
Explain how can type-insensitive macros be created?
What is bash c?
Why is c called c?
Why void is used in c?
What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers
Why do we need a structure?
How variables are declared in c?
print 1-50 with two loop & two print Statement
34.what are bitwise shift operators? 35.what are bit fields? What is the use of bit fields in a structure declaration? 36.what is the size of an integer variable? 37.what are the files which are automatically opened when a c file is executed? 38.what is the little endian and big endian? 39.what is the use of fflush() function? 40.what is the difference between exit() and _exit() functions? 41.where does malloc() function get the memory? 42.what is the difference between malloc() and calloc() function? 43.what is the difference between postfix and prefix unary increment operators?