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 c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30
struct point { int x; int y; }; struct point origin,*pp; main() { pp=&origin; printf("origin is(%d%d)\n",(*pp).x,(*pp).y); printf("origin is (%d%d)\n",pp->x,pp->y); }
Find the largest number in a binary tree
write a program for area of circumference of shapes
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.
Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };
print a semicolon using Cprogram without using a semicolon any where in the C code in ur program!!
35 Answers Tata Elxsi, TCS, VI eTrans,
Write a program using one dimensional array to assign values and then display it on the screen. Use the formula a[i]=i*10 to assign value to an element.
1 Answers Samar State University,
Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?
main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 b. 2, 100 c. 4, 100 d. 4, 4
18 Answers HCL, IBM, Infosys, LG Soft, Satyam,
#include<stdio.h> main() { int i=1,j=2; switch(i) { case 1: printf("GOOD"); break; case j: printf("BAD"); break; } }
void main() { static int i; while(i<=10) (i>2)?i++:i--; printf(“%d”, i); }