Link to home
Start Free TrialLog in
Avatar of thesunboy
thesunboy

asked on

array indexed 11-25

write a program that "creates" an array of int, that consist of 15 elements,indexed by numbers 11 to 25.
the array is to take 15 * sizeof(int)
bytes in memory.(answer has to be in "C" not "C++".
Avatar of mprao
mprao

The following program will solve ur problem


#pragma warning (disable :4786)
#include <iostream>
#include <map>
using namespace std;

void main()
{
  map<int, int> m;  // This is a pair of Key & value . They are associated array.
  for (int i =11,j=100;i<=25 ;i++,j++)
        m[i]=j;
  for (i =11;i<=25 ;i++)
        cout <<"Key : " << i <<"  Value : " <<  m[i] <<endl;
 }
Avatar of thesunboy

ASKER

i need to solve it in
c and not c++
Edited text of question.
ASKER CERTIFIED SOLUTION
Avatar of 042
042

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial