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

Code for 1>"ascii to string" 2>"string to ascii"

1 Answers   Aricent, Global Logic,


int aaa() {printf(“Hi”);} int bbb(){printf(“hello”);} iny ccc(){printf(“bye”);} main() { int ( * ptr[3]) (); ptr[0] = aaa; ptr[1] = bbb; ptr[2] =ccc; ptr[2](); }

1 Answers  


Write a Program that Inputs 10 Numbers in an Array and Show the Maximum Number

2 Answers   Ace Info,


void main() { static int i=5; if(--i){ main(); printf("%d ",i); } }

1 Answers  


3) Int Matrix of certain size was given, We had few valu= es in it like this. =97=97=97=97=97=97=97=97=97=97=97 1 = | 4 | | 5 | &= nbsp; | 45 =97=97=97=97=97=97=97=97=97=97=97 &n= bsp; | 3 | 3 | 5 | = | 4 =97=97=97=97=97=97=97=97=97=97=97 34 |&nbs= p; 3 | 3 | | 12 | &= nbsp; =97=97=97=97=97=97=97=97=97=97=97 3 | &nbs= p; | 3 | 4 | = | 3 =97=97=97=97=97=97=97=97=97=97=97 3 | = ; | | | = ; 3 | =97=97=97=97=97=97=97=97=97=97=97 &= nbsp; | | 4 | = ; | 4 | 3 We w= ere supposed to move back all the spaces in it at the end. Note: = If implemented this prog using recursion, would get higher preference.

0 Answers   RoboSoft,






find simple interest & compund interest

2 Answers  


#include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }

2 Answers   CNSI,


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

0 Answers  


main() { static int var = 5; printf("%d ",var--); if(var) main(); }

1 Answers  


What is the main difference between STRUCTURE and UNION?

13 Answers   HCL,


plz tell me the solution.......... in c language program guess any one number from 1 to 50 and tell that number within 8 asking question in yes or no...............

2 Answers   Wipro,


Printf can be implemented by using __________ list.

3 Answers  


Categories