+8

C programming

In which data type is mobile number included?

12/3/2019 2:01:44 PM

Srijan Rijal

+7

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.

+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

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

+4

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

+4

Bro, no worries. you gave your opinion.πππππ

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

+3

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

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

+2

String usually.

+2

We use string bro

+2

integer data type

+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

mobile number can be stored as long int ; and %ld as specifier

+1

I think it is of Long int data type

+1

You can use either string of character or int(long..). I think string of character will be bit easy .

+1

I think it's an interger and also it is a string

0

long long

0

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

0

int data type