+ 3

Wrong pointer-datatype?

What happens when I use a pointer of one datatype to point to a variable of another? Let's say I have a double variable and I use an int pointer to point to it. Does it matter? If it doesn't, why do we have to give pointers datatypes?

7th Jul 2016, 1:48 PM
MaxCode
2 Antworten
+ 2
it does matter, the pointer data type simply tells the program hey I want to look at this type of data. if you use let's say int x, char * y; It will tell you it cannot convert to int * from char*
7th Jul 2016, 3:17 PM
destro
+ 1
no problem if done with char or ints but with other data types it does matter
17th Jul 2016, 3:29 PM
manish rawat
manish rawat - avatar