DEV Community

Discussion on: Data Structure In C

Collapse
 
pauljlucas profile image
Paul J. Lucas

Please only put code inside backticks in Markdown. Words like integer should simply be written integer.

Sizes of primitive types are not specified by the C standard; only minimum sizes are. char is not guaranteed to be signed.

Any number that falls in the range of -∞ to +∞ is said to be an integer.

3.14 falls in that range, yet is not an integer.

The general size of a character is 1 byte. However, just like the integers the size of a char can vary according to the data type modifiers.

No modifier can change the size of char. Only the signed-ness can be modified.

Since all characters and symbols can be represented in their numerical ASCII value ...

No, ASCII can not accommodate all characters and symbols: that's why Unicode was invented.

The first one is that [double] occupies twice as much memory as type float.

Again, the C standard doesn't guarantee that.

However, the double data type consumes more memory and it is also slower as compared to float.

That's a far too simplistic answer; see here for a better answer.

data_type: This is the data type that specifies the type of elements to be stored in the array. It can be int, float, double, and char.

You can have an array of an infinite different types, not just int, float, double, or char.

size: The size specifies the number of elements held by the array. If the size is n then the number of array elements will be n-1.

No! The number of elements is n! It's just that they're indexed from 0 to n-1, but there are still n elements!

There are several other mistakes, too many to go through one by one. I'd suggested rewording much of your text to use more precise language in general and actually and say what is guaranteed by the C standard and what is typical.