void main()
{
int *i = 0x400; // i points to the address 400
*i = 0; // set the value of memory location pointed by i;
}
Answers were Sorted based on User's Feedback
Answer / amit kumar kunwar
as i is pointing to the address 400 and getting assigned a value of 0. this code is working perfectly. hence the Output is 0 for this code.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / susie
Answer :
Undefined behavior
Explanation:
The second statement results in undefined behavior because
it points to some location whose value may not be available
for modification. This type of pointer in which the
non-availability of the implementation of the referenced
location is known as 'incomplete type'.
Is This Answer Correct ? | 0 Yes | 1 No |
int i; main(){ int t; for ( t=4;scanf("%d",&i)-t;printf("%d\n",i)) printf("%d--",t--); } // If the inputs are 0,1,2,3 find the o/p
What is the main difference between STRUCTURE and UNION?
Write a program that reads a dynamic array of 40 integers and displays only even integers
Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };
write a c-program to display the time using FOR loop
Give a one-line C expression to test whether a number is a power of 2.
typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }
Write a C program to print look and say sequence? For example if u get the input as 1 then the sequence is 11 21 1211 111221 312211 12112221 .......(it counts the no. of 1s,2s etc which is in successive order) and this sequence is used in run-length encoding.
main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }
how can u draw a rectangle in C
53 Answers Accenture, CO, Codeblocks, Cognizant, HCL, Oracle, Punjab National Bank, SAP Labs, TCS, University, Wipro,
Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution)
Sorting entire link list using selection sort and insertion sort and calculating their time complexity
1 Answers Infosys, Microsoft, NetApp,