Table of Contents
- 1 Why address of operator is not required while reading the string using scanf?
- 2 What is the role of address operator in scanf function?
- 3 Where can we not use &( address operator in C )?
- 4 Why address operator is used in C?
- 5 Is address operator used in scanf () statement to read an array Why?
- 6 What arithmetic operators Cannot be used with strings A?
Why address of operator is not required while reading the string using scanf?
In case of strings which is an array of characters, the name of the string possesses the base address of the string i.e. the address of the first element of the string. Therefore, &(address-of) operator is not required while using scanf to scan a string.
What is the role of address operator in scanf function?
It tells where to write the input value, as the address of (&) operator give the address of the variable. so, scanf with variable name and address operator meane to write the value at this location.
Where can we not use &( address operator in C )?
It cannot be used on variable which are declared using register storage class.
What is the function of address of operator?
An address-of operator is a mechanism within C++ that returns the memory address of a variable. These addresses returned by the address-of operator are known as pointers, because they “point” to the variable in memory. The address-of operator is a unary operator represented by an ampersand (&).
What is the use of address operator in pointer in C?
The purpose of this address operator or pointer is used to return the address of the variable. Once we declared a pointer variable, we have to initialize the pointer with a valid memory address; to get the memory address of the variable ampersand is used.
Why address operator is used in C?
The Address Operator in C also called a pointer. The purpose of this address operator or pointer is used to return the address of the variable. Once we declared a pointer variable, we have to initialize the pointer with a valid memory address; to get the memory address of the variable ampersand is used.
Is address operator used in scanf () statement to read an array Why?
The arguments of the scanf() function are the pointers types, we must provide either an address of a variable or a pointer (which contains the address of the variable). Therefore, if we are using a pointer in scanf(), we don’t use address of (&) operator, because pointer contains the address itself.
What arithmetic operators Cannot be used with strings A?
Hence, we can only use two arithmetic operators(+ & *) with strings . Floor division (//), exponent(**), subtraction(-), division(/) and modulus(\%) operators are not use with strings. Hope it will help!