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)
{
...
Type: Posts; User: boxden
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)
{
...
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...
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...
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...
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...
For example:
int a = 5;
int &b = a;
++b;
b and a are both 6
Greetings
on wikipedia i read about these types, but is it possible to declare and use them in C?
oh god :) thanks hahaha what a stupid mistake :)
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...
oh thank you very much :) thought it was part of stdlib..
how come i can compile atoi but can't compile itoa lol :D
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;
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--;...
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...
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...
You even tiny url'ed it.
I've googled it before I came here.
i am looking for the most efficient way to check wetter an integer is prime or not
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,...
Thanks for all the response, Salem's in particular.
I was acctually doing a matrix project to refresh the pointer notation ^_^
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++)
I think it was pretty obvious I wasn't talking about the MAC-address lol
Thank you for the reply!
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...
yes i know but i mean without allocating. But I guess not than :) thank you
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...
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...
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";