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 : |
|
2 : |
|
3 : |
|
Answer: Option
Explanation:
C data types classification are
- Primary data types
- int
- char
- float
- double
- void
- Secondary data types (or) User-defined data type
- Array
- Pointer
- Structure
- Union
- 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 3 of 5.
Hari said:
9 years ago
Actually primary data types are OK. But user defined data type does't contain pointer array, they are derived data type.
Namrata said:
10 years ago
Both 1 and 2 is the write answer. enum is user defined in c#. Rest are not.
Siddharth said:
10 years ago
Is enum a user defined or derived data type or both?
Ragaveni said:
10 years ago
@Kavitha.
User defined datatypes are defined by user as per user convenience and these are defined by making use of predefined datatypes.
User defined datatypes are defined by user as per user convenience and these are defined by making use of predefined datatypes.
Vinita said:
10 years ago
@Saru.
Does the value of val and num automatically get incremented?
And if val1 was not initialized what value it would have taken ?
Does the value of val and num automatically get incremented?
And if val1 was not initialized what value it would have taken ?
Kavitha said:
10 years ago
What is meant by user defined data type?
Ayana said:
1 decade ago
String belongs to array. Its array of characters.
Pradeep chandra said:
1 decade ago
Then what about string?
Saru said:
1 decade ago
@Vineet
We cannot define: char enum day[sun,mon]
But we can give it as follows:
#include<stdio.h>
int main()
{
enum var {var1='a',var2,var3};
enum num {num1=5,num2,num3};
printf("%c %c %c \n",var1,var2,var3);
printf("%d %d %d",num1,num2,num3);
return 0;
}
Where the output will be:
a b c
5 6 7
Because, enum is a user defined data type. It is a data type by itself. So you cannot declare it with a built in data type.
We cannot define: char enum day[sun,mon]
But we can give it as follows:
#include<stdio.h>
int main()
{
enum var {var1='a',var2,var3};
enum num {num1=5,num2,num3};
printf("%c %c %c \n",var1,var2,var3);
printf("%d %d %d",num1,num2,num3);
return 0;
}
Where the output will be:
a b c
5 6 7
Because, enum is a user defined data type. It is a data type by itself. So you cannot declare it with a built in data type.
Shiva said:
1 decade ago
Then what is "long int l = 2.35;" data type called ?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers