logo

CuriousTab

CuriousTab

Discussion


Home Technical Questions Programming Comments

  • Question
  • If I use the following printf() to print a long int why I am not warned about the type mismatch? printf ("%d",num );


  • Correct Answer
  • When a function accepts a variable number of arguments , its prototype cannot provide any information about the number of arguments and type of those variable arguments Hence the compiler cannot warn about the mismatches The programmer must make sure that arguments match or must manually insert explicit typecast 


  • Programming problems


    Search Results


    • 1. What is the difference between malloc() and calloc() functions?
    • Discuss
    • 2. Can I increase the size of a dynamically allocated array? < Yes / No> if yes, how?
    • Discuss
    • 3. How would you free the memory allocated by the following program? #include "alloc.h" #define MAXROW 3 #define MAXCOL 4 main() { int **p, i; p = (int **) malloc (MAXROW * sizeof (int *)); for ( i = 0; i < MAXROW ; i++) p[i] = (int *) malloc (MAXCOL * sizeof (int )); }
    • Discuss
    • 4. How would you dynamically allocate a 2-D array of integers?
    • Discuss
    • 5. Improve the following code using typedef. struct node { int data1; float data2; struct node *left; struct node *right; }; struct node *ptr; ptr = (struct node *) malloc (sizeof (struct node) );
    • Discuss
    • 6. How would you use qsort() function to sort an array of structures?
    • Discuss
    • 7. What will be output of following c code? #include int main() { int i; for(i=10;i<=15;i++){ while(i){ do{ printf("%d ",1); if(i>1) continue; }while(0); break; } } return 0; }
    • Discuss
    • 8. What will be output of following c code? void main() { struct bitfield { unsigned a:5; unsigned c:5; unsigned b:6; }bit; char *p; struct bitfield *ptr,bit1={1,3,3}; p=&bit1; p++; clrscr(); printf("%d",*p); getch(); }
    • Discuss
    • 9. What will be output when you will execute following c code? #include enum actor { SeanPenn=5, AlPacino=-2, GaryOldman, EdNorton }; void main() { enum actor a=0; switch(a) { case SeanPenn: printf("Kevin Spacey"); break; case AlPacino: printf("Paul Giamatti"); break; case GaryOldman:printf("Donald Shuterland"); break; case EdNorton: printf("Johnny Depp"); } }

    • Options
    • A. Kevin Spacey
    • B. Paul Giamatti
    • C. Donald Shuterland
    • D. Johnny Depp
    • Discuss
    • 10. Write a c program to create dos command type.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment