Based on my understanding of data types: computers can only store 0 and 1, it cannot store a negative number, real number, character, etc. Thus, data types were created to represent (encode) each of these data types as a set of 0s and 1s, and then decode it when necessary.
But what about structure:
struct Student
{
int age;
float gpa;
};
Student s1; s1.age = 17; s1.gpa = 3.42;
Student s2; s2.age = 16; s2.gpa = 3.64;
This is like an object, so I don't need to write:
int student1_age = 17;
float student1_gpa = 3.42;
int student2_age = 16;
float student2_gpa = 3.64;
So, is it correct to consider a Studentdata type in the same way that a floatis a data type?
user4344762
source
share