C programming | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

C programming

In which data type is mobile number included?

3rd Dec 2019, 2:01 PM
Srijan Rijal
Srijan Rijal - avatar
29 Answers
+ 8
A string a phone number isnt an integer its rather a string as you wont be performing subtraction or division or anything of that sort.
3rd Dec 2019, 2:04 PM
Creeper FRM
Creeper FRM - avatar
+ 6
You can use string/array for it. Although you are dealing with numbers here but generally we don't do arithmatic operations with mobile number I think array/string should be a nice chooce
3rd Dec 2019, 2:05 PM
Arsenic
Arsenic - avatar
+ 5
If we see logically mobile number consists of all numbers and not any special character or letter so it should be saved in integer category......but it's up to the user they can save it into a string format too coz they are not going to perform operations on mobile number it,s more of a personal data than an mathematical number.
1st Jun 2020, 8:32 AM
pariii_kasliwal🎭
pariii_kasliwal🎭 - avatar
+ 4
Whosoever has downvoted my answer is stupid. It was just a suggestion that it can be stored like this as well. Completely unnecessary.
3rd Dec 2019, 2:45 PM
Avinesh
Avinesh - avatar
+ 4
Bro, no worries. you gave your opinion.👍👍👍👌👌
3rd Dec 2019, 2:48 PM
Srijan Rijal
Srijan Rijal - avatar
+ 4
Typically, a numerical data type would be used. If you can moderate how the user enters it (Such as removing any dashes / spaces) you could use a numeric data type.
5th Dec 2019, 6:02 PM
Stephen Matthew
Stephen Matthew - avatar
+ 3
This would do I guess long long a = 1234567890; printf("%lld",a);
3rd Dec 2019, 2:15 PM
Avinesh
Avinesh - avatar
+ 2
if we see logically mobile number consists of all numbers and not any special character or letter so it should be saved in integer category......but it's up to the user they can save it into a string format too coz they are not going to perform operations on mobile number it,s more of a personal data than an mathematical number. hope it helps :)
4th Dec 2019, 7:31 AM
Ashish bhushan kumar
Ashish bhushan kumar - avatar
+ 2
String usually.
5th Dec 2019, 11:47 AM
Sonic
Sonic - avatar
+ 2
We use string bro
10th Apr 2021, 2:42 PM
Ndeleche Hamis
Ndeleche Hamis - avatar
+ 2
integer data type
23rd Apr 2021, 7:42 AM
RAHUL K
+ 1
I would use a string. People tend to include spaces or dashes in their numbers, or for international numbers a + with country code. Some people put brackets around (area code) and most importantly, a lot of phone numbers without country code start with a 0. int 0612345678 would get stored as 612345678 with the 0 getting dropped. Too much room for variation and depending on what you want to do with the phone numbers, save yourself from going through the effort of making it an int/long and making a regex for all the cases I mentioned. If you go for an int you should make sure it can store like 32 bits so depending on your language an int is probably fine unless a long is 32 bit for historic reasons in a dinosaur language.
4th Dec 2019, 8:16 PM
Brendon Bosman
Brendon Bosman - avatar
+ 1
Int data type
5th Dec 2019, 1:12 AM
Sandeep Singh
Sandeep Singh - avatar
+ 1
I think it is of Long int data type
6th Jun 2020, 2:19 PM
Yamala Harsha Sravani
Yamala Harsha Sravani - avatar
+ 1
You can use either string of character or int(long..). I think string of character will be bit easy .
21st Dec 2020, 8:26 PM
Anshul Neekhara
Anshul Neekhara - avatar
+ 1
I think it's an interger and also it is a string
23rd Apr 2021, 10:32 AM
Ndeleche Hamis
Ndeleche Hamis - avatar
+ 1
String
29th Nov 2021, 1:47 PM
VENKATA SATHWIK REDDY DANDA
0
long long
4th Dec 2019, 3:07 PM
Jagbir singh
Jagbir singh - avatar
0
Sandeep singh it's not int datatype it is...long long .dt
5th Dec 2019, 2:31 AM
Thé Ka|yan M!shrā
Thé Ka|yan M!shrā - avatar
0
int data type
5th Dec 2019, 5:35 AM
kavi Priya T