0

Hi guys I just started C today and am a complete Noobie just got to data type and I am having trouble understanding it

The problem lies in (int float char and double) they keep giving a value My question is what is the use of it and how do I use it

26th Aug 2019, 8:03 PM
Balogun Daniel
Balogun Daniel - avatar
3 Answers
+ 2
different data types are used for different types of data. for example: a string is used for text an int is used for a whole number (so no decimal point) the reason why there are different data types mostly has to do with available memory. in int is “cheaper” (costs less processing power and memory) than a float. nowadays it doesn’t matter that much for modern computers or even phones, but when you are working embedded (hardware programming) every tick (processing power unit) is important
26th Aug 2019, 8:13 PM
Brave Tea
Brave Tea - avatar
+ 2
char is a singles character e.g 'A' int is a whole number float is a number with a decimal point double is a number with a decimal point but can hold a larger number than float. Use the <limits.h> and <float.h> to find the upper and lower limits, here's an example for an int:- #include <stdio.h> #include <limits.h> int main() { printf("%d \n", INT_MAX); printf("%d \n", INT_MIN); return 0; }
26th Aug 2019, 8:24 PM
rodwynnejones
rodwynnejones - avatar
0
C has variables, which are containers of data(number, character, address, etc). There are a few types of variables- int, char, float, etc. Each type has its own properties- size, possible range, etc.
26th Aug 2019, 8:54 PM
daniel
daniel - avatar