0

Type on pointers

Normally every pointer can be defined as int right? So why is an pointer to a double variable not also an int ? Only to be consistent? Thanks, Leon

2nd Nov 2016, 3:15 PM
Leon
Leon  - avatar
1 Answer
0
it's because when you declare an int pointer, it is meant to point only to integer value. In c++, double and int are different datatypes. So a pointer of one type cannot point to a different datatype.
3rd Nov 2016, 1:34 AM
kamal joshi
kamal joshi - avatar