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

enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }

2 Answers  


int i,j; for(i=0;i<=10;i++) { j+=5; assert(i<5); }

3 Answers   Cisco, HCL,


How can I Create a C program in splitting set of characters to specific subsets. Example: INPUT SET OF CHARACTERS: Therefore, my dear brothers and sisters, stand firm. Let nothing move you. Always give yourselves fully to the work of the Lord, because you know that your labor in the Lord is not in vain. SPLIT INTO HOW MANY CHARACTERS PER SUBSETS: 10 OUTPUT: Therefore, my dear b rothers an d sisters, stand fir m. Let not hing move you. Alway s give you rselves fu lly to the work of t he Lord, b ecause you know that your labo r in the L ord is not in vain.

0 Answers  


Find your day from your DOB?

15 Answers   Accenture, Microsoft,


how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.

0 Answers   Mbarara University of Science and Technology,






Predict the Output: int main() { int *p=(int *)2000; scanf("%d",2000); printf("%d",*p); return 0; } if input is 20 ,what will be print

2 Answers  


main() { printf("\nab"); printf("\bsi"); printf("\rha"); }

3 Answers  


There are 21 people in a room. They have to form groups of 3 people each. How many combinations are possible? Write a C program to print the same.

1 Answers   TCS,


what is the code of the output of print the 10 fibonacci number series

2 Answers  


main() { struct date; struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }

1 Answers  


How to return multiple values from a function?

7 Answers  


write a program to Insert in a sorted list

4 Answers   Microsoft,


Categories