Will this pose an error ? As I'm taking an integer type pointer to a float value | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Will this pose an error ? As I'm taking an integer type pointer to a float value

int *x, *y; float i=1.6; int a=6; x=&i; y=&a; x++; y++;

14th Nov 2019, 3:22 AM
Hima
Hima - avatar
4 Answers
0
Yes it will point out a type error.
14th Nov 2019, 3:26 AM
Avinesh
Avinesh - avatar
0
It's just giving me warnings
14th Nov 2019, 3:27 AM
Hima
Hima - avatar
0
Maybe because the pointer is always an unsigned int type and it can point to any data type. But you create int pointer for integers and char pointer for characters, and I have never tried this way so thought it would give an error.
14th Nov 2019, 3:34 AM
Avinesh
Avinesh - avatar
0
you should typecast that before asigning it to a pointer
14th Nov 2019, 7:38 AM
✳AsterisK✳
✳AsterisK✳ - avatar