9451. The '->' operator can be used to access structures elements using a pointer to a structure variable only
9452. It is not possible to create an array of pointer to structures.
9453. If the following structure is written to a file using fwrite(), can fread() read it back successfully? struct emp { char n; int age; }; struct emp e={"IndiaBIX", 15}; FILE fp; fwrite(&e, sizeof(e), 1, fp);
9454. size of union is size of the longest element in the union
9455. The elements of union are always accessed using & operator
9456. Will the following code work? #include<stdio.h> #include<malloc.h> struct emp { int len; char name[1]; }; int main() { char newname[] = "Rahul"; struct emp p = (struct emp ) malloc(sizeof(struct emp) -1 + strlen(newname)+1); p->len = strlen(newname); strcpy(p -> name, newname); printf("%d %s\n", p->len, p->name); return 0; }
9457. A pointer union CANNOT be created
9458. Is there easy way to print enumeration values symbolically?
9459. By default structure variable will be of auto storage class
9460. Is it necessary that the size of all elements in a union should be same?
9461. Can we have an array of bit fields?
9462. Will the following declaration work? typedef struct s { int a; float b; }s;
9463. Can a structure can point to itself?
9464. If a char is 1 byte wide, an integer is 2 bytes wide and a long integer is 4 bytes wide then will the following structure always occupy 7 bytes? struct ex { char ch; int i; long int a; };
9465. How will you free the allocated memory ?
9466. What is the similarity between a structure, union and enumeration?
9467. The adjective of obey is
9468. HAPHAZARD means
9469. What will be the output of the program? #include<stdio.h> int main() { enum color{red, green, blue}; typedef enum color mycolor; mycolor m = red; printf("%d", m); return 0; }
9470. What will be the output of the program? #include<stdio.h> int main() { typedef int arr[5]; arr iarr = {1, 2, 3, 4, 5}; int i; for(i=0; i<4; i++) printf("%d,", iarr[i]); return 0; }
9471. What will be the output of the program? #include<stdio.h> int main() { typedef int LONG; LONG a=4; LONG b=68; float c=0; c=b; b+=a; printf("%d,", b); printf("%f\n", c); return 0; }
9472. What will be the output of the program? #include<stdio.h> int main() { typedef float f; static f fptr; float fval = 90; fptr = &fval; printf("%f\n", fptr); return 0; }
9473. What will be the output of the program? #include<stdio.h> typedef struct error {int warning, err, exception;} ERROR; int main() { ERROR e; e.err=1; printf("%d\n", e.err); return 0; }
9474. In the following code snippet can we declare a new typedef named ptr even though struct employee has not been completely declared while using typedef? typedef struct employee ptr; struct employee { char name[20]; int age; ptr next; }
9475. Point out the error in the following code? typedef struct { int data; NODEPTR link; }NODEPTR;
9476. Is the following declaration acceptable? typedef long no, ptrtono; no n; ptrtono p;
9477. Is there any difference in the #define and typedef in the following code? typedef char string_t; #define string_d char ; string_t s1, s2; string_d s3, s4;
9478. Are the properties of i, j and x, y in the following program same? typedef unsigned long int uli; uli i, j; unsigned long int x, y;
9479. typedef's have the advantage that they obey scope rules, that is they can be declared local to a function or a block whereas #define's always have a global effect.
9480. In the following code, the P2 is Integer Pointer or Integer? typedef int ptr; ptr p1, p2;
9481. In the following code what is 'P'? typedef char charp; const charp P;
9482. What is x in the following program? #include<stdio.h> int main() { typedef char ((arrfptr[3])())[10]; arrfptr x; return 0; }
9483. The compulsory Education Act will ensure education to the children upto the age of—
9484. The correctly spelt word is
9485. This beach is usually closed _____ a rainy day.
9486. Point out the error in the following program. #include<stdio.h> #include<stdarg.h> fun(...); int main() { fun(3, 7, -11.2, 0.66); return 0; } fun(...) { va_list ptr; int num; va_start(ptr, n); num = va_arg(ptr, int); printf("%d", num); }
9487. Point out the error if any in the following program (Turbo C). #include<stdio.h> #include<stdarg.h> void display(int num, ...); int main() { display(4, 'A', 'a', 'b', 'c'); return 0; } void display(int num, ...) { char c; int j; va_list ptr; va_start(ptr, num); for(j=1; j<=num; j++) { c = va_arg(ptr, char); printf("%c", c); } }
9488. Point out the error in the following program. #include<stdio.h> #include<stdarg.h> void varfun(int n, ...); int main() { varfun(3, 7, -11, 0); return 0; } void varfun(int n, ...) { va_list ptr; int num; num = va_arg(ptr, int); printf("%d", num); }
9489. Point out the error in the following program. #include<stdio.h> #include<stdarg.h> int main() { void display(char s, int num1, int num2, ...); display("Hello", 4, 2, 12.5, 13.5, 14.5, 44.0); return 0; } void display(char s, int num1, int num2, ...) { double c; char s; va_list ptr; va_start(ptr, s); c = va_arg(ptr, double); printf("%f", c); }
9490. Point out the error in the following program. #include<stdio.h> #include<stdarg.h> int main() { void display(int num, ...); display(4, 12.5, 13.5, 14.5, 44.3); return 0; } void display(int num, ...) { float c; int j; va_list ptr; va_start(ptr, num); for(j=1; j<=num; j++) { c = va_arg(ptr, float); printf("%f", c); } }
9491. Point out the error in the following program. #include<stdio.h> #include<stdarg.h> void display(char s, ...); void show(char t, ...); int main() { display("Hello", 4, 12, 13, 14, 44); return 0; } void display(char s, ...) { show(s, ...); } void show(char t, ...) { int a; va_list ptr; va_start(ptr, s); a = va_arg(ptr, int); printf("%f", a); }
9492. Point out the error in the following program. #include<stdio.h> #include<stdarg.h> void varfun(int n, ...); int main() { varfun(3, 7, -11.2, 0.66); return 0; } void varfun(int n, ...) { float ptr; int num; va_start(ptr, n); num = va_arg(ptr, int); printf("%d", num); }
9493. The macro va_arg is used to extract an argument from the variable argument list and advance the pointer to the next argument.
9494. In a function that receives variable number of arguments the fixed arguments passed to the function can be at the end of argument list.
9495. A function that receives variable number of arguments should use va_arg() to extract arguments from the variable argument list.
9496. For a function receives variable number of arguments it is necessary that the function should receive at least one fixed argument.
9497. A function that receives variable number of arguments should use va_arg() to extract the last argument from the variable argument list.
9498. va_list is an array that holds information needed by va_arg and va_end
9499. The macro va_start is used to initialise a pointer to the beginning of the list of fixed arguments.
9500. Can we pass a variable argument list to a function at run-time?