Book Your slot
X
ONLINE BOOKING
BOOK NOW
OFFLINE BOOKING
Call or WhatsApp 7993732682 (WhatsApp Now), 9177341827 (WhatsApp Now)
search
Menu Login home
  • Questions

  • Library

  • University Updates

  • Informatives

  • Technology Lines

  • Training & Internships

  • X
    Menu
  • Home
  • Privacy Policy
  • Legal Disclaimer
  • Terms & Conditions
  • Return Policy
  • About Us
  • Need any help?? write to us at

    support@engineershub.co

    Follow Us

    X
    LOGIN
    Login to access posts, links, updates, question papers, materials, one liners!
    Use Your Email Address/Mobile and Password to Login
    Forgot Password?
    Not a member? Sign Up
    LOGIN WITH EMAIL/MOBILE
    Forgot Password?
    Go Back
    FORGOT PASSWORD
    Go Back
    RESET PASSWORD
    Go Back
    Continue with LinkedIn
    OR
    Fill Up a Simple Form
    Already a Member? Login
    SIGN UP
    Fill all the below details correctly and click on Next
    Go Back
    Explain user-defined data types? - EngineersHub
    Go Back
    Question
    Vinod Raj
    3 years ago
    1 Answer(s) posted Write an answer 3476
    Answer
    Read Mode
    Answer posted by Naseem Shaik
    3 years ago

    C supports the idea of programmers creating their own data types.

    Ordinal Data Types :

    Ordinal data types have the following characteristics:

      1. There exists a smallest value in the set of values.

      2. There exists the largest value in the set of values.

      3. There exists an order of values from the smallest to the largest.

    Example:

    The “char” data type is an ordinal data type. Each character value has an integer value associated with it. There are 256 characters.

      1. The smallest character value has the ASCII value of 0.

      2. The largest character value has the ASCII value of 255.

      3. The sequence of ASCII values is 0, 1, 2,......., 253, 254, 255.

      ‘A’ == 65 ‘B’ == 66 ‘C’ == 67 etc....

    The data types that are defined by the user are called user-defined derived data types.

      1. Enumeration(enum)

      2. Typedef defined DataType(typedef)

    1. Enumeration: Enumeration (or enum) is a user-defined data type in C. It is mainly used to assign names to integral constants, the names make a program easy to read and maintain.

      Syntax:  enum State {Working = 1, Failed = 0};

    Eg:

    #include 
    
    enum week { Mon, Tue, Wed,Thur, Fri, Sat, Sun };
    
    int main()
    
    {
    enum week day;
    
    day = Wed;
    
    printf(“%d”,day);
    
    return 0;
    
    }

    2. Typedef defined DataType (typedef):

    Using typedef does not actually create a new data class, rather it defines a name for an existing type.

    This can increase the portability(the ability of a program to be used across different types of machines.  i.e., mini, mainframe, micro, etc without much changes into the code)of a program as only the typedef statements would have to be changed.

      Syntax:  typedef type name;

    Users Joined

    mahek thakur
    7 months ago
    sowmya
    7 months ago
    biraja
    8 months ago
    Diana R
    8 months ago
    P Annapoorani
    8 months ago
    X
    Explain user-defined data types?
    X
    Explain user-defined data types?

    C supports the idea of programmers creating their own data types.

    Ordinal Data Types :

    Ordinal data types have the following characteristics:

      1. There exists a smallest value in the set of values.

      2. There exists the largest value in the set of values.

      3. There exists an order of values from the smallest to the largest.

    Example:

    The “char” data type is an ordinal data type. Each character value has an integer value associated with it. There are 256 characters.

      1. The smallest character value has the ASCII value of 0.

      2. The largest character value has the ASCII value of 255.

      3. The sequence of ASCII values is 0, 1, 2,......., 253, 254, 255.

      ‘A’ == 65 ‘B’ == 66 ‘C’ == 67 etc....

    The data types that are defined by the user are called user-defined derived data types.

      1. Enumeration(enum)

      2. Typedef defined DataType(typedef)

    1. Enumeration: Enumeration (or enum) is a user-defined data type in C. It is mainly used to assign names to integral constants, the names make a program easy to read and maintain.

      Syntax:  enum State {Working = 1, Failed = 0};

    Eg:

    #include 
    
    enum week { Mon, Tue, Wed,Thur, Fri, Sat, Sun };
    
    int main()
    
    {
    enum week day;
    
    day = Wed;
    
    printf(“%d”,day);
    
    return 0;
    
    }

    2. Typedef defined DataType (typedef):

    Using typedef does not actually create a new data class, rather it defines a name for an existing type.

    This can increase the portability(the ability of a program to be used across different types of machines.  i.e., mini, mainframe, micro, etc without much changes into the code)of a program as only the typedef statements would have to be changed.

      Syntax:  typedef type name;

    EngineersHub Logo
    x
    Loading...