Semester : S1 and S2
Subject : Computer Programming
Year : 2018
Term : MARCH
Branch : BIOTECHNOLOGY
Scheme : 2015 Full Time
Course Code : CS 100
Page:27
int main()
{
int array[100], search, c, n;
printf("Enter the number of elements inarray\n"); scanf("%d",&n);
printf("Enter %d
integer(s)\n", n);
for (c=0;c
&array[c]);
printf("Enter the number to search\n"); scanf("%d",
&search);
for (c = 0; ८ < 0; c++)
{ 1 (array[c]==search) ٭/ if required element found */
printf("%d is present at location %d.\n", search, c+1); break;
) ) (550) _ printf("%d is not present in array.\n",
search); return 0;
}
b)
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 (&). It is also known as an
address operator.
Address operators commonly serve two purposes:
1. To conduct parameter passing by reference, suchas by name
2. To establish pointer values. Address-of operators point to the location in the memory because
the value of the pointer is the memory address/location where the data item resides in
memory.