0

How to resolve this error?

#include <stdio.h> int main() { int x = 10, y = 12; char * a; a = &x; x = 1xab; printf("%d%d", x, * a); return 0; } And please explain the reason of error too

16th Oct 2019, 6:14 PM
Preity
Preity - avatar
2 ответов
+ 1
x = 1xab; This is not a valid syntactically. I'm not sure what you expected out of this. a = &x; You are assigning an address that points to a incompatible data type. Char pointer here can only point to a one byte data, while the data itself is int (commonly four bytes data).
17th Oct 2019, 7:35 AM
Ipang
+ 2
You not define Variable ----> b Are you multiply in x = 1xab or 1*a*b
16th Oct 2019, 7:23 PM
Mohammed Qadir khan
Mohammed Qadir khan - avatar