0
whats the difference between "string" and "int"?
6 Answers
+ 4
int is an integer, which is a real number. string is text.
+ 2
int is a primitive variable to store integer numbers.
String is an object with methods that allow text manipulation.
+ 1
int is an integer that stores real numbers. A string is a collection (more properly an "array") of elements. You can put integers into a string but it will be stored as a chatacter and not an integer. This means you cant add two numbers that are stored in a string.
Example:
Can do:
int num1 = 3;
int num2 = 2;
int sum = num1 + num2;
Cant do:
string num1 = "3";
string num2 = "2";
string sum = "num1 + num2";
(This will have compiler erros since the compiler doesnt recognize these numbers as an integer, but merely as a collection of elemnts)
0
int- a whole number. 1 ,2 ,3, 4 and so on
string- text. such as a player's name
float. and number with a decimal. 1.1f; 2.8f; 5.0f;. must have 'f' after number
bool is a true or false statement. lightsOn = true;
this is for C#. not sure about the others
0
As others have responded, int is an integer number and string is a text. By adding integers 1 and 2, your result would be 3. By 'adding' strings "1" and "2", your result would be "12".
0
Int has numeric and string has A to Z , special character ,