Is this code legal?

int *ptr;

ptr = (int *) 0x400;



Is this code legal? int *ptr; ptr = (int *) 0x400;..

Answer / susie

Answer :

Yes

Explanation:

The pointer ptr will point at the integer in the
memory location 0x400.

Is This Answer Correct ?    17 Yes 2 No

Post New Answer

More C Code Interview Questions

main() { unsigned int i=10; while(i-->=0) printf("%u ",i); }

2 Answers   HP,


int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr)); }

2 Answers   CSC,


main() { int i=_l_abc(10); printf("%d\n",--i); } int _l_abc(int i) { return(i++); }

2 Answers  


What is the problem with the following code segment? while ((fgets(receiving array,50,file_ptr)) != EOF) ;

1 Answers  


Program to Delete an element from a doubly linked list.

4 Answers   College School Exams Tests, Infosys,






main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); }

1 Answers  


#include<conio.h> main() { int x,y=2,z,a; if(x=y%2) z=2; a=2; printf("%d %d ",z,x); }

1 Answers  


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

0 Answers  


write a c program to print magic square of order n when n>3 and n is odd?

1 Answers   HCL,


{ int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }

4 Answers  


how can u draw a rectangle in C

53 Answers   Accenture, CO, Codeblocks, Cognizant, HCL, Oracle, Punjab National Bank, SAP Labs, TCS, University, Wipro,


Write a C program that defines a 2-dimentional integer array called A [50][50]. Then the elements of this array should randomly be initialized either to 1 or 0. The program should then print out all the elements in the diagonal (i.e. a[0][0], a[1][1],a[2][2], a[3][3], ……..a[49][49]). Finally, print out how many zeros and ones in the diagonal.

2 Answers  


Categories