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



void main() { int *i = 0x400; // i points to the address 400 *i = 0; //..

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

void main() { int *i = 0x400; // i points to the address 400 *i = 0; //..

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

Post New Answer

More C Code Interview Questions

void main() { int k=ret(sizeof(float)); printf("\n here value is %d",++k); } int ret(int ret) { ret += 2.5; return(ret); }

1 Answers  


Write a program to receive an integer and find its octal equivalent?

7 Answers  


How to return multiple values from a function?

7 Answers  


typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }

1 Answers  


Is the following code legal? void main() { typedef struct a aType; aType someVariable; struct a { int x; aType *b; }; }

1 Answers  






main() { char a[4]="HELLO"; printf("%s",a); }

3 Answers   CSC,


main() { int a=10,*j; void *k; j=k=&a; j++; k++; printf("\n %u %u ",j,k); }

1 Answers  


main() { char *a = "Hello "; char *b = "World"; clrscr(); printf("%s", strcat(a,b)); } a. Hello b. Hello World c. HelloWorld d. None of the above

3 Answers   HCL,


Sir... please give some important coding questions asked by product companies..

0 Answers  


Declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

1 Answers  


Under linux environment can u please provide a c code for computing sum of series 1-2+3-4+5......n terms and -1+2-3+4-5...n terms..

2 Answers  


I need your help, i need a Turbo C code for this problem.. hope u'll help me guys.? Your program will have a 3x3 array. The user will input the sum of each row and each column. Then the user will input 3 values and store them anywhere, or any location or index, temporarily in the array. Your program will supply the remaining six (6) values and determine the exact location of each value in the array. Example: Input: Sum of row 1: 6 Sum of row 2: 15 Sum of row 3: 24 Sum of column 1: 12 Sum of column 2: 15 Sum of column 3: 18 Value 1: 3 Value 2: 5 Value 3: 6 Output: Sum of Row 1 2 3 6 4 5 6 15 7 8 9 24 Sum of Column 12 15 18 Note: Your program will not necessary sort the walues in the array Thanks..

0 Answers  


Categories