I'm so dumb, 😂 i don't understand why int float and char used before a, b, salary and letter? Explain me yr. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I'm so dumb, 😂 i don't understand why int float and char used before a, b, salary and letter? Explain me yr.

#include <stdio.h> int main() { int a, b; float salary = 56.23; char letter = 'Z'; a = 8; b = 34; int c = a+b; printf("%d \n", c); printf("%f \n", salary); printf("%c \n", letter); return 0; }

2nd May 2019, 7:49 AM
Mr. Nothing
Mr. Nothing - avatar
5 Answers
+ 7
int is used for integer number which can be any number in negative or positive according to your need. Ex int a; // a will contain integer values Float is used for floating point value like Float salary = 56.23 According to the ex you mention Char is used for character or alphabets like Char letter = 'a';
2nd May 2019, 7:53 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 1
Aman You started too many different languages at the same time! Python is a much much later technology than C++. Seeing that you lacks basic understanding of programming, I suggest you drop both Python and C++ now, and focus on C, which is more fundamental.
2nd May 2019, 11:53 AM
Gordon
Gordon - avatar
0
Sooo we write data type names according what value is?
2nd May 2019, 7:55 AM
Mr. Nothing
Mr. Nothing - avatar
0
And if we not write it than?
2nd May 2019, 7:55 AM
Mr. Nothing
Mr. Nothing - avatar
0
Lol i take a long time to understand your question. After the name of varible you must define the type of that variable. Are the rules of syntaxe of that language. Is the same for c++, java, c# and many more language like this language i indicate.
3rd May 2019, 1:23 AM
Werg Serium
Werg Serium - avatar