CoolInterview.com - World's Largest Collection of Interview Questions
Start Your Own website Now
Sponsored Links

Interview Questions
Our Services

Get 9,000 Interview Questions & Answers in an eBook.


  • 9500+ Pages
  • 9000 Question & Answers
  • All Tech. Categories
  • 14 MB Content

    Get it now !!



    Send your Resume to 6000 Companies


  • INTERVIEW QUESTIONS C OPERATORS IN C DETAILS
    Question :
    When should a type cast not be used?
    Category Operators in C Interview Questions
    Rating (0.4) By 2180 users
    Added on 10/22/2004
    Views 4518
    Rate it!
    Answers:

    A type cast should not be used to override a const or volatile declaration. Overriding these type modifiers can cause the program to fail to run correctly.

    A type cast should not be used to turn a pointer to one type of structure or data type into another. In the rare events in which this action is beneficial, using a union to hold the values makes the programmer?s intentions clearer.



    Type cast can be done when we want to convert the data in one type to another type

    e.g:-in order to change the data from double data type to integer data type... But it is not used to convert integer data type to double data type.......

    e.g:-
    #include<stdio.h>
    #include<conio.h>
    main()
    {
    double d=10.434;
    clrscr();
    int a=(double)d;
    printf("%ld",d);
    printf("%d",a);
    getch();
    }

    The otput will be

    10.434
    10



    Posted by: rani    

    Contact rani Contact rani

    If you have the better answer, then send it to us. We will display your answer after the approval.
    Rules to Post Answers in CoolInterview.com:-

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
  • Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification  Enter the above shown code:*
    Inform me about updated answers to this question

       
    Related Questions
    View Answer
    Can math operations be performed on a void pointer?
    View Answer
    What is a modulus operator? What are the restrictions of a modulus operator?
    View Answer
    Why n++ executes faster than n+1?
    View Answer


    Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

    View ALL Operators in C Interview Questions

    User Options
    Sponsored Links


    Copyright ©2003-2014 CoolInterview.com, All Rights Reserved.
    Privacy Policy | Terms and Conditions

    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Dedicated Servers | C Interview Questions & Answers

    Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes


    Cache = 0.015625 Seconds