logo

CuriousTab

CuriousTab

Discussion


Home Technical Questions Programming Comments

  • Question
  • Point out the error, ifany, in the followingb code? typedef struct { int data; NODEPTR link; } *NODEPTR;


  • Correct Answer
  • A typedef defines a new name for a type, and in simpler cases like the one shown below you can define a new structure type and a typedef for it at the same time typedef struct { char name[20]; int age; } emp; However, in the structure defined in this question, there is an error because a typedef declaration cannot be used until it is defined In the given code fragment the typedef declaration is not yet defined at he point where the link field is declared 


  • Programming problems


    Search Results


    • 1. What would be the output of the following program? main() { char ch ='A'; printf ("%d%d", sizeof (ch), sizeof ('A')); }
    • Discuss
    • 2. How would you eliminate the warning generated on complaining the following program? main() { char far *scr; scr = 0xB8000000; *scr = 'A'; }
    • Discuss
    • 3. Would the following program compile? main() { int a = 10, *j; void *k; J = k = &a; J++; k++; printf ("\n%u %u", j, k); }
    • Discuss
    • 4. What would be the output of the following program, if the array beigns at address 65486? main() { int arr[] = {12,14,15,23,45}; printf ("%u %u", arr, &arr); }
    • Discuss
    • 5. How would you obtain segment and offset addresses from a far address of a memory location?
    • Discuss
    • 6. 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 = { "Sujay",15}; FILE *fp; fwrite (&e, sizeof (e), 1, fp);
    • Discuss
    • 7. What would be the output of the following program? main() { struct emp { char *n; int age; }; struct emp e1 = { "Dravid", 23}; struct emp e2 = e1; strupr (e2.n); printf ("\n%s",e1.n); }
    • Discuss
    • 8. How would you check whether the contents of two structure variables are same or not?
    • Discuss
    • 9. Point out the error, if any, in the following program. # include "stdio.h" main() { FILE *fp; char str[80]; fp = fopen ("trail", "r"); while (!feof (fp)) { fgets (str, 80, fp); puts (str); } fclose (fp); }
    • Discuss
    • 10. What would be the output of the following program? /* sample.c */ main ( int argc, char **argv ) { argc = argc - (argc -1); printf ("%s", argv[argc - 1]); }
    • Discuss


    Comments

    There are no comments.

Enter a new Comment