how to write a data 10 in address location 0x2000

Answers were Sorted based on User's Feedback



how to write a data 10 in address location 0x2000..

Answer / vishnu

int main()
{
int *ptr;
ptr = (int *)0x2000;
*ptr = 10;
printf("%d", *ptr);
}

Is This Answer Correct ?    5 Yes 1 No

how to write a data 10 in address location 0x2000..

Answer / vatsava

int main()
{
int *ptr;
ptr = (int *)2000;
*ptr = 10;
printf("%d", *ptr);
}

Is This Answer Correct ?    1 Yes 0 No

how to write a data 10 in address location 0x2000..

Answer / vadivel t

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

Post New Answer

More C Interview Questions

What happens if header file is included twice?

0 Answers  


write a program of palindrome(madam=madam) using pointer?

5 Answers   L&T,


Why c is called top down?

0 Answers  


Explain how can type-insensitive macros be created?

0 Answers  


What is bash c?

0 Answers  






Why is c called c?

0 Answers  


Why void is used in c?

0 Answers  


What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers

0 Answers  


Why do we need a structure?

0 Answers  


How variables are declared in c?

0 Answers  


print 1-50 with two loop & two print Statement

2 Answers  


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?

3 Answers  


Categories