0

whats the difference between "string" and "int"?

23rd Feb 2017, 4:03 AM
Farhan Fuad
Farhan Fuad - avatar
6 Answers
+ 4
int is an integer, which is a real number. string is text.
23rd Feb 2017, 4:07 AM
Dadang NH
Dadang NH - avatar
+ 2
int is a primitive variable to store integer numbers. String is an object with methods that allow text manipulation.
23rd Feb 2017, 5:07 AM
seamiki
seamiki - avatar
+ 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)
24th Feb 2017, 2:28 AM
ivann
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
23rd Feb 2017, 7:05 PM
Robby Coberly
Robby Coberly - avatar
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".
7th Mar 2017, 2:46 PM
Stephen Jukes
0
Int has numeric and string has A to Z , special character ,
23rd Aug 2023, 7:49 AM
Javiya Pujan