main()

{

register int a=2;

printf("Address of a = %d",&a);

printf("Value of a = %d",a);

}

Answers were Sorted based on User's Feedback



main() { register int a=2; printf("Address of a = %d",&a); ..

Answer / susie

Answer :

Compier Error: '&' on register variable

Rule to Remember:

& (address of ) operator cannot be applied on register
variables.

Is This Answer Correct ?    3 Yes 1 No

main() { register int a=2; printf("Address of a = %d",&a); ..

Answer / chandra

It all depends on C/C++.

On C(GNU C/Visual studio C compiler), it will get a compiler
error.
since the keyword with register is stored in registers of
CPU rather than in memory locations of RAM.

On C++(GNU C++/Visual stdio C++ compiler), variable 'a' will
get an address of memory locations.
since register will automatically take address of memory

Is This Answer Correct ?    1 Yes 0 No

main() { register int a=2; printf("Address of a = %d",&a); ..

Answer / shrikantauti

Will produce an error as the memory address s not provided.
%u should had written instead of %d

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C Code Interview Questions

Finding a number which was log of base 2

1 Answers   NetApp,


Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?

0 Answers   Honeywell,


struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1;def.prev=&abc;def.next=&ghi; ghi.i=2;ghi.prev=&def; ghi.next=&jkl; jkl.i=3;jkl.prev=&ghi;jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); }

1 Answers  


Given n nodes. Find the number of different structural binary trees that can be formed using the nodes.

16 Answers   Aricent, Cisco, Directi, Qualcomm,


main() { char c; int i = 456; clrscr(); c = i; printf("%d", c); } a. 456 b. -456 c. random number d. none of the above

3 Answers   BrickRed, HCL,






write a program to find out roots of quadratic equation "x=-b+-(b^2-4ac0^-1/2/2a"

2 Answers  


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

3 Answers   Wipro,


1. const char *a; 2. char* const a; 3. char const *a; -Differentiate the above declarations.

3 Answers  


main() { static int a[3][3]={1,2,3,4,5,6,7,8,9}; int i,j; static *p[]={a,a+1,a+2}; for(i=0;i<3;i++) { for(j=0;j<3;j++) printf("%d\t%d\t%d\t%d\n",*(*(p+i)+j), *(*(j+p)+i),*(*(i+p)+j),*(*(p+j)+i)); } }

1 Answers  


main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }

2 Answers  


programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h

1 Answers  


Give a one-line C expression to test whether a number is a power of 2.

10 Answers   Microsoft,


Categories