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 2 of 5.

Sivaraman said:   9 years ago
How to identify user-defined data type? Give example.

Bhujbal said:   9 years ago
The answer should be 1 and 2 both more precisely.

Bal said:   9 years ago
Hey I think m little bit confused user defined data types are typedef n enum and derived data types are structure array etc.

Kumar said:   10 years ago
So basically only secondary data types are user defined? am I correct.

Harsha said:   10 years ago
@Jjjay.

We can write long int as.

Long int i = 2.35.

It is syntactically correct in c lang.

The question is which one is not user defined data type, as long int, int are predefined in c language.

Arpit said:   10 years ago
string is a user defined datatype because we can define string as char name[20] string is an array of character.

Jjjay said:   10 years ago
We can't write long int l = 2.35;
If you want to declare long int.

Write it like this:

long int l=2.35L

Mayu said:   1 decade ago
Then what is "long int l = 2.35;" data type called ?

Reshma said:   1 decade ago
String is user defined data type or primary data type? can anyone explain.

Amol Kotwal said:   1 decade ago
What is difference between Long int and Float data types?

Can anyone explain it?


Post your comments here:

Your comments will be displayed after verification.