Is the following code legal?
struct a
{
int x;
struct a *b;
}
Answers were Sorted based on User's Feedback
Answer / susie
Answer :
Yes.
Explanation:
*b is a pointer to type struct a and so is legal. The
compiler knows, the size of the pointer to a structure even
before the size of the structure
is determined(as you know the pointer to any type is of same
size). This type of structures is known as
‘self-referencing’ structure.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / pavan_mustyala
The code snippet is absolutely valid and this concept which
is comes under "self- referential" concept is used to
develop linked lists.
| Is This Answer Correct ? | 0 Yes | 0 No |
Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all.
2 Answers Mentor Graphics, Microsoft,
can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail
main() { int i = 0xff ; printf("\n%d", i<<2); } a. 4 b. 512 c. 1020 d. 1024
main() { signed int bit=512, mBit; { mBit = ~bit; bit = bit & ~bit ; printf("%d %d", bit, mBit); } } a. 0, 0 b. 0, 513 c. 512, 0 d. 0, -513
3 Answers HCL, Logical Computers,
write a c program to print magic square of order n when n>3 and n is odd?
main() { int k=1; printf("%d==1 is ""%s",k,k==1?"TRUE":"FALSE"); }
what is the output of the below program & why ? #include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); }
How to use power function under linux environment.eg : for(i=1;i<=n;i++){ pow(-1,i-1)} since it alerts undefined reference to 'pow'.
#include <stdio.h> #define a 10 main() { #define a 50 printf("%d",a); }
main() { char *cptr,c; void *vptr,v; c=10; v=0; cptr=&c; vptr=&v; printf("%c%v",c,v); }
main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }
29 Answers IBM, TCS, UGC NET, Wipro,
main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }