+4

C programming

In which data type is mobile number included?

c

12/3/2019 2:01:44 PM

Srijan Rijal

14 Answers

New Answer

+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.

+5

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

+4

Bro, no worries. you gave your opinion.👍👍👍👌👌

+3

This would do I guess long long a = 1234567890; printf("%lld",a);

+3

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 :)

+2

Whosoever has downvoted my answer is stupid. It was just a suggestion that it can be stored like this as well. Completely unnecessary.

+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.

+1

Int data type

+1

String usually.

0

long long

0

Sandeep singh it's not int datatype it is...long long .dt

0

int data type

0

I would rather go with a string

0

i dont think we can use int for storing phone nos because here in India we have phone no starting with 0 and we know that will give error syntactically or number systems way. String are used for storing phone nos.