Search:

Type: Posts; User: boxden

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. function to copy an array->something going wrong with sizeof()

    Whilest implementing merge sort, i had to create a function that copies an array into another one. Something went wrong, though. At first my code looked like this:



    void printArray(int *a)
    {
    ...
  2. Replies
    1
    Views
    1,162

    Linked List question

    I have a base class "Artikel" and a couple of derived classes "AudioCD" and "Boek"

    Then I have a class "Winkel" that has a private member ArtikelLijst* stok. Stok is the head of a linked list that...
  3. Replies
    4
    Views
    1,068

    thank you for the reply guys, i was compiling it...

    thank you for the reply guys, i was compiling it like this
    g++ *.cpp

    what flags do i need to set to have the same behavior as C's gcc -ansi -Wall -pedantic?

    also laserlight, could you tell me...
  4. Replies
    4
    Views
    1,068

    allocation and freeing of an array of ints

    first of all, how come you can do this in C++ and not in C

    int a[n];

    secondly, why is the array "a" being printed after i freed it in the following piece of code:

    int *a = new...
  5. Replies
    2
    Views
    1,017

    Pointer confusion

    Say I have a class Pawn with a constructor Pawn(enum colors {white,black} Color).

    Now, somewhere else in my program, I have to make a 2D array of pointers pointing to pawns.

    First of all, how...
  6. Replies
    3
    Views
    3,024

    Does C also have reference parameters

    For example:

    int a = 5;
    int &b = a;
    ++b;

    b and a are both 6

    Greetings
  7. Replies
    6
    Views
    7,678

    octaword, double quadword

    on wikipedia i read about these types, but is it possible to declare and use them in C?
  8. oh god :) thanks hahaha what a stupid mistake :)

    oh god :) thanks hahaha what a stupid mistake :)
  9. Trying to calculate the sum of all primes < 2M, fault in algorithm

    Can anybody see why the following piece of code does not provide the correct output for the calculation of the sum of all primes < 2 000 000?


    #include <stdio.h>
    #include <math.h>
    int...
  10. oh thank you very much :) thought it was part of...

    oh thank you very much :) thought it was part of stdlib..
    how come i can compile atoi but can't compile itoa lol :D
  11. undefined symbols error when using itoa on macbook pro

    does anybody know why this piece of code is not compiling?


    #include <stdio.h>
    #include <stdlib.h>

    int palindromic(int number);

    int main() {
    int greatest = 0;
  12. For those interested, this is very clean and...

    For those interested, this is very clean and short

    __int64 number = 317584931803;
    int divisor = 2;
    while (number > 1) {
    if (0 == (number % divisor)) {
    number /= divisor;
    divisor--;...
  13. Lol, I replaced numb / 2 with sqrt(numb) and it...

    Lol, I replaced numb / 2 with sqrt(numb) and it found a solution within a second :)
    I should have thought about that... Thank you for all the help.
    And nice work, bernt. I just started today, this...
  14. Well it is for this problem: The prime...

    Well it is for this problem:


    The prime factors of 13195 are 5, 7, 13 and 29.

    What is the largest prime factor of the number 600851475143 ?

    My isPrime algorithm:

    int isPrime(unsigned...
  15. You even tiny url'ed it. I've googled it before...

    You even tiny url'ed it.
    I've googled it before I came here.
  16. looking for efficient algoritm to check wetter an integer is prime or not

    i am looking for the most efficient way to check wetter an integer is prime or not
  17. Replies
    10
    Views
    2,851

    size of allocated array

    When I try to check the size of an array that is allocated, it always tells me the size is 8, no matter how many bytes I allocate. When I check the size of an array that is declared the normal way,...
  18. Thanks for all the response, Salem's in...

    Thanks for all the response, Salem's in particular.



    I was acctually doing a matrix project to refresh the pointer notation ^_^
  19. is aligning with printf() via a variable value possible?

    void PrintMatrix(int **matrix, int rij, int kolom)
    {
    int i, j;

    printf("Resultaat: \n");

    for (i = 0; i < rij; i++)
    {
    printf("[");
    for (j = 0; j < kolom - 1; j++)
  20. I think it was pretty obvious I wasn't talking...

    I think it was pretty obvious I wasn't talking about the MAC-address lol
    Thank you for the reply!
  21. [MAC] installing glade and stopping in the middle

    Hello

    Yesterday, I installed GTK+ on my macbook pro and I wanted to download Glade via macports (sort of synaptics for mac) but I stopped in the middle because I had to go. Now some files are...
  22. Replies
    8
    Views
    2,840

    yes i know but i mean without allocating. But I...

    yes i know but i mean without allocating. But I guess not than :) thank you
  23. Replies
    8
    Views
    2,840

    I get what you mean laserlight, you are right....

    I get what you mean laserlight, you are right.
    But isn't there a way to give a value to a char pointer that isn't pointing to anything? I really thought there was a possibility to do this? Just...
  24. Replies
    8
    Views
    2,840

    yeah i used gets for a quick example i also...

    yeah i used gets for a quick example

    i also thought you were able to declare a string like char *conststring; and then give it a value via gets() or fgets() or what ever, but you just werent able...
  25. Replies
    8
    Views
    2,840

    Declaring a string as char ptr

    when you declare a string lets say

    char *string;

    can you give it a value? fe: gets(string)
    or can you only use it as a const string like

    char *string = "blabla";
Results 1 to 25 of 45
Page 1 of 2 1 2