C Programming - Declarations and Initializations - Discussion

Discussion Forum : Declarations and Initializations - General Questions (Q.No. 7)
7.
Which of the following is not user defined data type?
1 :
struct book
{
    char name[10];
    float price;
    int pages;
};
2 :
long int l = 2.35;
3 :
enum day {Sun, Mon, Tue, Wed};
1
2
3
Both 1 and 2
Answer: Option
Explanation:

C data types classification are

  1. Primary data types
    1. int
    2. char
    3. float
    4. double
    5. void
  2. Secondary data types (or) User-defined data type
    1. Array
    2. Pointer
    3. Structure
    4. Union
    5. Enum

So, clearly long int l = 2.35; is not User-defined data type.
(i.e.long int l = 2.35; is the answer.)

Discussion:
48 comments Page 4 of 5.

Tanishka said:   1 decade ago
Can any one give the example of Union?

Vineet said:   1 decade ago
can we define : char enum day[sun,mon];

Karthick said:   1 decade ago
Structure is the collection of different datatype under the common name, union is similar to structure the difference is. In union we can achieve the memory management ie, only the particular data that we call will occupy memory, enum is already explained above.

Rakesh kumar said:   1 decade ago
Can you explain me in detail the difference between structure, union and enum operations?

Manas said:   1 decade ago
Primitive types are declaration types and the primitive type is already defined by the java programming language. There are eight primitive types defined in java: int, char, boolean, short, void, long, float, double.

Non primitive types are called java reference types and they have name starting with capital letter. Eg: Integer, Float etc.

Laasya said:   1 decade ago
Can you explain me in detail the difference between structure, union and enum operations?

Krishna said:   1 decade ago
Can you explain me the union operation?

Krishna said:   1 decade ago
Which is the nonprimitive datatype in c++?

Levin max said:   1 decade ago
Primitive data types are already predefined data types as such as int , float,double etc. whereas non primitive data types are created by d users as such as objects in java....

Thanvi said:   1 decade ago
What is the difference b/w primitive n nonprimitive data type?


Post your comments here:

Your comments will be displayed after verification.