In C, explain the difference between the & operator and the * operator?
Submitted by: Administrator& is the address operator, and it creates pointer values.
* is the indirection operator, and it preferences pointers to access the object pointed to.
Example:
In the following example, the pointer ip is assigned the address of variable i (&i). After that assignment, the expression *ip refers to the same object denoted by i:
int i, j, *ip;
ip = &i;
i = 22;
j = *ip; /* j now has the value 22 */
*ip = 17; /* i now has the value 17 */
Submitted by: Administrator
* is the indirection operator, and it preferences pointers to access the object pointed to.
Example:
In the following example, the pointer ip is assigned the address of variable i (&i). After that assignment, the expression *ip refers to the same object denoted by i:
int i, j, *ip;
ip = &i;
i = 22;
j = *ip; /* j now has the value 22 */
*ip = 17; /* i now has the value 17 */
Submitted by: Administrator
Read Online Electrical Engineering Job Interview Questions And Answers
Top Electrical Engineering Questions
☺ | CO2 fire extinguishers are indicated by the color code |
☺ | In a star connected three phase transformer the |
☺ | A single-phase double-wound transformer consists of |
☺ | A residual current device will disconnect under |
☺ | The usual method of insulating core laminations is |
Top Best Engineering Categories
☺ | Mechanical Engineering Interview Questions. |
☺ | Civil Engineering Interview Questions. |
☺ | Chemical Engineering Interview Questions. |
☺ | Electrical Engineering Interview Questions. |
☺ | Automobile Engineering Interview Questions. |