Electrical Engineering Question:
Download Questions PDF

In C, explain the difference between the & operator and the * operator?


& is the address operator, and it creates pointer values.
* is the indirection operator, and it preferences pointers to access the object pointed to.

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 */

Download Electrical Engineering Interview Questions And Answers PDF

Previous QuestionNext Question
Write the code for finding the factorial of a passed integer. Use a recursive subroutine?Write a function to determine whether a string is a palindrome (same forward as reverse, such as "radar" or "mom")