logo

CuriousTab

CuriousTab

Discussion


Home Technical Questions Programming Comments

  • Question
  • What would be the output of the following program? main() { char huge * near * far *ptr1; char near * far * huge *ptr2; char far * huge * near *ptr3; printf ("%d%d%d", sizeof (ptr1), sizeof (ptr2), sizeof (ptr3)); }


  • Correct Answer
  • 4 4 2 


  • Programming problems


    Search Results


    • 1. Point out the error, if any, in the following program. #include "stdarg.h" main() { display ( 4, 12.5, 13.5, 14.5, 44.3); } 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 ("\n%f", c); } }
    • Discuss
    • 2. Point out the error, if any, in the following program. #include "stdio.h" main() { unsigned char; FILE *fp; fp = fopen ("trail", "r"); while (( ch = getc (fp)) ! = EOF) printf ("%c", ch); fclose (fp); }
    • Discuss
    • 3. How would you find the length of each string in the following Program? main() { char *str[] = { "Frogs", "Do", "Not" , "Die" , "They" , "Croak!"}; printf ("%d%d", sizeof (str), sizeof (str[0])); }
    • Discuss
    • 4. What would be the output of the following program? main() { char a[] = "Visual C++"; char *b = "Visual C++"; printf ("\n%d %d", sizeof (a), sizeof (b)); printf ("\n%d %d", sizeof (*a), sizeof (*b)); }
    • Discuss
    • 5. What will be output of following program? #include int main() { void (*p)(); int (*q)(); int (*r)(); p = clrscr; q = getch; r = puts; (*p)(); (*r)("www.curioustab.com"); (*q)(); return 0; }

    • Options
    • A. NULL
    • B. www.curioustab.com
    • C. Compilation error
    • D. None of above
    • Discuss
    • 6. How would you use the function memmove()?
    • Discuss
    • 7. What will be output of following program ? #include int main() { int a = 10; void *p = &a; int *ptr = p; printf("%u",*ptr); return 0; }

    • Options
    • A. 10
    • B. Address
    • C. 2
    • D. Compilation error
    • Discuss
    • 8. What will output when you compile and run the following code? #include struct student { int roll; int cgpa; int sgpa[8]; }; void main() { struct student s = { 12,8,7,2,5,9 }; int *ptr; ptr = (int *)&s; clrscr(); printf( "%d", *(ptr+3) ); getch(); }

    • Options
    • A. 8
    • B. 7
    • C. 2
    • D. Compiler error
    • Discuss
    • 9. C program to find whether a number is palindrome or not.
    • Discuss
    • 10. Write a c program to find out sum of diagonal element of a matrix.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment