Couple of things here:
1) A mobile number is not a number in the traditional sense: it is a string, not an integer. Don't believe me? Phone your best mate without using a leading zero ...
If you can't do maths with it, it isn't a number, and should not be stored as such.
(And also, a mobile number can contain other characters such as brackets, and plus.)
This ignores that the size of integer varies from system to system: on some it may only be 16 bits, which is too short to holed a mobile number anyway.
2) When you do this:
ptr->mobilenumber
you
dereference the pointer and return the value that is contained in the integer, not the address of the integer. So when you do this:
scanf("%u", ptr->mobilenumber);
you pass the content of the variable to
scanf
- which is either random of zero depending on your compiler and options - and it will treat it as an address. At that point your app is very likely to crash or do very strange things!
You need to pass the address of the integer, not it's content:
scanf("%u", &(ptr->mobilenumber));
It works for arrays of characters because the name of an array is a pointer to the first element of the array itself.
What I would do is read the user input into an array of characters, and then process it to the variable you want, checking that it fits before I did it.