0

I tried to do

char ** ptr = (char**)100

in C and tried to add ptr +(int)ptr and i expected that answer would be 200, but aactually its 500. Can someone explain how this work?

Also when I tried with single pointer char * ptr = (char*)100 or even without themchar ptr = (char)100, answer was 200 and that really confused me.

  • SO goes to some effort to make it difficult to suggest that you put "pointer arithmetic" into a search box and see what your favourite search engine comes up with. But that's what you should do. Alternatively, find a good introduction to C. – rici Jan 14 '22 at 01:36

0 Answers0