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

Chandini agrawal said:   9 years ago
We can't declare a variable as a digit. Then how is it correct to write int 1 = 2.35?
(2)

Sachin10'R said:   9 years ago
What is difference between typedef and enum?
(1)

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

Siddharth said:   1 decade ago
Is enum a user defined or derived data type or both?

Namrata said:   1 decade ago
Both 1 and 2 is the write answer. enum is user defined in c#. Rest are not.

Hari said:   1 decade ago
Actually primary data types are OK. But user defined data type does't contain pointer array, they are derived data type.

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

Can anyone explain it?

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

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

Jjjay said:   1 decade 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


Post your comments here:

Your comments will be displayed after verification.