Jump to content

precisys

Member
  • Posts

    24
  • Joined

  • Last visited

Reputation Activity

  1. Like
    precisys got a reaction from pmarion427 in Thread For Tech Quickie Video Suggestions   
    Mouse grips.
    Cooler types.
    NAS.
  2. Like
    precisys got a reaction from 2chriswy in Thread For Tech Quickie Video Suggestions   
    Mouse grips.
    Cooler types.
    NAS.
  3. Like
    precisys got a reaction from kirashi in 37,000-machine study finds most reliable Windows PC is a Mac   
    It's not just the hardware that needs to be faster. If the fastest hardware in the world has crappy drivers it can't win against a slower hardware with awesome drivers.
  4. Like
    precisys got a reaction from MikeD in Damn Pointers...   
    I added some comments and fixed some things. If there's something you don't understand feel free to ask.
     #include <iostream>using namespace std;void copyArray(int *a, int *b, int n);int main (){    const int ARRAY1 = 3;    int a[ARRAY1]; //If you add * here you'll be declaring a vector of pointers to int.    const int ARRAY2 = 3;    int b[ARRAY2];    int i = 0;        for(i = 0; i < ARRAY1; i++)    {        cout << "Please input your number\n";        cin >> a [i]; //Here you don't need to put the * because when you do a[i] you're doing *(a+i)    }        copyArray(a, b, ARRAY1); //a and b are already vectors, if you do *a and *b you're actually passing the first value of each vector. Also you can use ARRAY1 instead of n (there's no need to declare an extra variable)        for(i = 0; i < ARRAY1; i++) //this prints each element of the b vector        cout << b[i];    cout << '\n';        return 0;} void copyArray(int *a, int *b, int n){    int i;    for(i = 0; i < n; i++)        *b++ = *a++;}/* another way of implementing this function would be the following *//*void copyArray(int *a, int *b, int n){ while(n-- > 0)        *b++ = *a++;}*/ // Also, you dont need ARRAY1 and ARRAY2. You'll be copying the contents of the first to the second, so they'll have the same size. You could use more meaningfull names for constants, for example, ARRAY_SIZE This compiles, runs and produces the expected output.
  5. Like
    precisys got a reaction from Mr. Brovahkiin in Damn Pointers...   
    I added some comments and fixed some things. If there's something you don't understand feel free to ask.
     #include <iostream>using namespace std;void copyArray(int *a, int *b, int n);int main (){    const int ARRAY1 = 3;    int a[ARRAY1]; //If you add * here you'll be declaring a vector of pointers to int.    const int ARRAY2 = 3;    int b[ARRAY2];    int i = 0;        for(i = 0; i < ARRAY1; i++)    {        cout << "Please input your number\n";        cin >> a [i]; //Here you don't need to put the * because when you do a[i] you're doing *(a+i)    }        copyArray(a, b, ARRAY1); //a and b are already vectors, if you do *a and *b you're actually passing the first value of each vector. Also you can use ARRAY1 instead of n (there's no need to declare an extra variable)        for(i = 0; i < ARRAY1; i++) //this prints each element of the b vector        cout << b[i];    cout << '\n';        return 0;} void copyArray(int *a, int *b, int n){    int i;    for(i = 0; i < n; i++)        *b++ = *a++;}/* another way of implementing this function would be the following *//*void copyArray(int *a, int *b, int n){ while(n-- > 0)        *b++ = *a++;}*/ // Also, you dont need ARRAY1 and ARRAY2. You'll be copying the contents of the first to the second, so they'll have the same size. You could use more meaningfull names for constants, for example, ARRAY_SIZE This compiles, runs and produces the expected output.
  6. Like
    precisys got a reaction from majorawsome in Damn Pointers...   
    A pointer is a memory address.
    You use "&" to get the address where a variable is stored and "*" to get the value stored on a specified address.
    About the code (adding to what the above user said):
    I would use a for loop instead of a while which would remove the need for an extra variable with a sum of mixed types (a pointer and an int).
    Also, vectors are pointers and pointers are vectors, which means pointers can be indexed.
    When you declare a vector you are declaring a special type of pointer, which cannot be modified itself (you can modify the values it contains).
  7. Like
    precisys got a reaction from MonkeyButt in Steelseries 7h   
    I have the SteelSeries 7h and music sounds good. I'm not much of an audiophile though.
×