CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2009
    Posts
    140

    Question how to make an int array? *basic question

    hi, i want to use things like:

    int in;

    in[1] = 1;
    in[2] = 1;
    in[4] = 6;
    in [i] = i;

    so later i can check things like:

    if(in[i] == 1){
    do things();
    }
    else if(in[i] == 2){
    do things2();
    }

    what type of thingy do i need to create for this?
    i tried char in[200]; but it allways said in[i] == 1 for any value O_o
    Last edited by Owyn; May 14th, 2009 at 05:44 AM.

  2. #2
    Join Date
    Aug 2006
    Posts
    98

    Re: how to make an int array? *basic question

    instead of "char in[200]", use "int in[200]"

  3. #3
    Join Date
    May 2009
    Posts
    140

    Re: how to make an int array? *basic question

    just tried int in[200]; but it says in every [] i have 1 =\ that means that i either write to [] wrong or read from [] wrong nothing else?

  4. #4
    Join Date
    Aug 2006
    Posts
    98

    Re: how to make an int array? *basic question

    If you write "int in[200]", then all the values in the array should be initially set to zero.

    Can you paste your code so I can get a better idea of what you are trying to do.

  5. #5
    Join Date
    May 2009
    Posts
    140

    Re: how to make an int array? *basic question

    figured out already default case was run after others and replaced all values with 1 =\ thx

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured