answersLogoWhite

0

#inculde<iostream>

using namespace std;

int smallestIndex(int[],int) //function prototype

void main()

{

int arr[10]={2,5,6,9,3,7,1,15,12,10};

int position;

position=smallestIndex(arr,10);

cout<<"the smallestIndex

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Engineering

How do you fill array in gw basic?

In GW-BASIC, you can fill an array using a loop. For example, to fill an array named A with values from 1 to 10, you can use a FOR loop like this: DIM A(10) FOR I = 1 TO 10 A(I) = I NEXT I This initializes each element of the array A with its index value. You can modify the loop to fill the array with any specific values or calculations as needed.


C code on Reversing integer array elements using temporary variable?

#include &lt;stdio.h&gt; int main() { int number, temp; printf("enter the number"); scanf("%d",&amp;number); printf("\n reverse of %d",number); while(number&gt;0) { temp=temp*10+number%10; number=number/10; } printf(" is %d",temp); }


What is the program of 2d array in gw basic?

In GW-BASIC, a 2D array can be declared using the DIM statement, specifying the number of rows and columns. For example, DIM A(5, 5) creates a 2D array named A with 6 rows and 6 columns (indexing starts from 0). You can access and manipulate elements using syntax like A(row, column). Here's a simple example: A(1, 1) = 10 assigns the value 10 to the element in the second row and second column of the array.


How do you calculate address of any element of array using formulae?

element_address = array_address + (element_index * element_size) Note that the array name refers to the start address of the array, element indices are always zero-based and element size is calculated at compile time using the sizeof() operator using the array type as the operand. int x[10]; int* p1 = x + (5 * sizeof(int)); // calculate address of 6th element int* p2 = &amp;x[5]; // return address of 6th element assert (p1==p2); // ensure both address are equal Note that the array suffix operator [] used by p2 is merely sugar-coating. Behind the scenes, the compiler will automatically generate code equivalent to that of the p1 calculation. As such, there is no advantage in using one over the other.


How you can use array in c language?

An array is a contiguous block of memory containing one or more elements of the same type and size. Each element in the array is accessed as a zero-based offset from the start of the array or by using the index []. Examples: int a[10]; // allocates memory for 10 integers (e.g., 40 bytes for a 4 byte int). int x = a[5]; // accesses the 6th element (a[0] is the first element). int *p = a; // point to start of the array. p += 5; // advance pointer 5 * sizeof( int ) addresses. *p = 10; // access the 6th element and assign the value 10. int d * = new int[*p]; // dynamically allocate an array of 10 elements. delete [] d; // release dynamic array.

Related Questions

How do you store a number of integers entered by the user in an array with java?

use a loop(for or while) to get the input from the user then store each in the array using the Scanner class like this import java.util.Scanner;//before class declaration int[] Array = new int[10]; //just an example gets 10 ints from user Scanner input = new Scanner(System.in); then something like this for(int i = 0; i &lt; 10;i++) { System.out.println("enter number:"); Array[i]= input.nextInt(); }


How do you create a loop using PHP?

There are a number of different ways to loop using PHP. They're as follows:ForForeachWhileDo-whileBelow are some examples of how each of these types of loop work.ForForeachWhileDo-while


How do you fill array in gw basic?

In GW-BASIC, you can fill an array using a loop. For example, to fill an array named A with values from 1 to 10, you can use a FOR loop like this: DIM A(10) FOR I = 1 TO 10 A(I) = I NEXT I This initializes each element of the array A with its index value. You can modify the loop to fill the array with any specific values or calculations as needed.


C code on Reversing integer array elements using temporary variable?

#include &lt;stdio.h&gt; int main() { int number, temp; printf("enter the number"); scanf("%d",&amp;number); printf("\n reverse of %d",number); while(number&gt;0) { temp=temp*10+number%10; number=number/10; } printf(" is %d",temp); }


What is the program of 2d array in gw basic?

In GW-BASIC, a 2D array can be declared using the DIM statement, specifying the number of rows and columns. For example, DIM A(5, 5) creates a 2D array named A with 6 rows and 6 columns (indexing starts from 0). You can access and manipulate elements using syntax like A(row, column). Here's a simple example: A(1, 1) = 10 assigns the value 10 to the element in the second row and second column of the array.


How do you calculate address of any element of array using formulae?

element_address = array_address + (element_index * element_size) Note that the array name refers to the start address of the array, element indices are always zero-based and element size is calculated at compile time using the sizeof() operator using the array type as the operand. int x[10]; int* p1 = x + (5 * sizeof(int)); // calculate address of 6th element int* p2 = &amp;x[5]; // return address of 6th element assert (p1==p2); // ensure both address are equal Note that the array suffix operator [] used by p2 is merely sugar-coating. Behind the scenes, the compiler will automatically generate code equivalent to that of the p1 calculation. As such, there is no advantage in using one over the other.


How you can use array in c language?

An array is a contiguous block of memory containing one or more elements of the same type and size. Each element in the array is accessed as a zero-based offset from the start of the array or by using the index []. Examples: int a[10]; // allocates memory for 10 integers (e.g., 40 bytes for a 4 byte int). int x = a[5]; // accesses the 6th element (a[0] is the first element). int *p = a; // point to start of the array. p += 5; // advance pointer 5 * sizeof( int ) addresses. *p = 10; // access the 6th element and assign the value 10. int d * = new int[*p]; // dynamically allocate an array of 10 elements. delete [] d; // release dynamic array.


Can you help me with the C plus plus code of the program which has 10 index of array it adds 5 into every even elements of the array and then it subtracts 10 into the odd elements of the array?

int array[10] = {...}; for (int i = 0; i &lt; 10; ++i) { if (i % 2 == 0) array[i] += 5; else array[i] -= 10; }


What numbers 2 to 10 make only one array?

The numbers from 2 to 10 that can form only one unique array (or arrangement) are 2, 3, 4, 5, 6, 7, 8, 9, and 10. This is because each of these numbers can be represented by a single array consisting of just that number itself. For instance, the number 2 can only be represented as [2], and similarly for the other numbers. In contrast, the number 1 can be arranged as a single element array or combined with other elements to create different arrays.


How do you make a program that counts how many times each digit occured in the integer?

To count the number of times a digit occurs in an integer, start by initializing an array of ten counts of digits, such as int digits[10];Then, in a loop while the number is non zero, increment the element in the digits array that corresponds to the units digit, and then divide the number by ten, such as digits[number%10]++ and number/=10;int digits[10];int i;int number = some number;for (i=0; i


What is typically the last subscript in an array?

In most programming languages, the last subscript (or index) in an array is typically one less than the total number of elements in the array. This is because array indexing usually starts at zero. For example, in an array with 10 elements, the last subscript would be 9.


How do you access and store the elements of array?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; int main(void) { int a[10],i;//array declaration clrscr(); printf("\n enter the elements of array"); for(i=0;i&lt;10;i++) scanf("%d",&amp;a[i]); printf("\n the elements you enter into the array"); for(i=0;i&lt;10;i++) printf("%5d",a[i]); getch(); return 0; }