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
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 |
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 |
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 |
Write a program to model an exploding firecracker in the xy plane using a particle system
main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a. Runtime error. b. I am OK c. Compile error d. I am O
why array index always strats wuth zero?
1) int i=5; j=i++ + i++ + i++; printf("%d",j);This code gives the answer 15.But if we replace the value of the j then anser is different?why? 2)int i=5; printf("%d",i++ + i++ + i++); this givs 18.
#define f(g,g2) g##g2 main() { int var12=100; printf("%d",f(var,12)); }
{ int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }
How to return multiple values from a function?
main() { int i; clrscr(); printf("%d", &i)+1; scanf("%d", i)-1; } a. Runtime error. b. Runtime error. Access violation. c. Compile error. Illegal syntax d. None of the above
Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };
enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }
How to count a sum, when the numbers are read from stdin and stored into a structure?
program to Reverse a linked list
12 Answers Aricent, Microsoft, Ness Technologies,