@Ramesh yes you can assign value at it.But Void pointer can be used to point at any kind of variable but on dereferencing you must cast it. eg : In above case *((int*)vp) = 3 will work.try it..
@priyaranjan u said dat u can assign value at it but again u r saying dat u hav to dereference it. i think its a conflict dude. when u r typecasting something it no longer behaves like a void pointer.
Given an integer n, write a function that returns count of trailing zeroes in n!. Examples: Input: n = 5 Output: 1 Factorial of 5 is 20 which has one trailing 0. Input: n = 20 Output: 4 Factorial of 20 is 2432902008176640000 which has 4 trailing zeroes. Input: n = 100 Output: 24
*vp = 3;
ReplyDeletevp is a void pointer. pointing to void. not an integer pointer. so cant assign an integer at the location pointed by void pointer.?
@Ramesh yes you can assign value at it.But Void pointer can be used to point at any kind of variable but on dereferencing you must cast it.
ReplyDeleteeg : In above case *((int*)vp) = 3 will work.try it..
@priyaranjan u said dat u can assign value at it but again u r saying dat u hav to dereference it. i think its a conflict dude. when u r typecasting something it no longer behaves like a void pointer.
ReplyDelete@above please elaborate what you want to say...
ReplyDelete