0

difference between *p and p*

if p=3 *p= //value p*= //value

20th Jun 2016, 11:37 PM
Priyanshu
Priyanshu - avatar
3 Answers
0
It's different operators. "*p=?" will write what you wrote for "?" to address 3 in memory, if your operating system let's you access it (assuming p is a pointer). The * operator dereferences the pointer p and the = operator assigns a new value to that position in memory. "*=?" is a single operator that means in context of p "p = p * ?" ("?" needs to be filled in by a number)
21st Jun 2016, 6:56 AM
Stefan
Stefan - avatar
0
if *p is pointer variable then what is value?
21st Jun 2016, 7:15 AM
Priyanshu
Priyanshu - avatar
0
Hi Privanshu, it's the data that is in your memory on address 3. If p is a pointer to int (int*) the data at this memory address will be interpreted as an integer number, if it's a pointer to double, it's interpreted as a double and so on...
21st Jun 2016, 7:19 AM
Stefan
Stefan - avatar