here we are typecasting an address not a value.
when q was integer and say an int takes 4 bytes so q was incrementing like 0->4->8->12.... where 0,4,8,12 are address locations.
when q was typecasted and made char and say a char takes 1 bytes so q will incrementing like 0->1->2->3.... where 0,1,2,3 are address locations.
So typecasting will definitely effect the program. Typecasting may lead to data loss.
for eg:- if 3.134 is converted into int then it becomes 3.
In the above program if q was not typecasted then q + 1 would have pointed to 164+3 =167 since q was a structure pointer.