Name: oppie 2010-11-03 14:30
hey Computers, quick C++ question
I get an <error: expected ',' or '...' before 'chArr'> in the first line when compiling this. Is there a special way of naming array arguments? I don't get it...
String::String(const char[] chArr)
{
Length = 0;
while(chArr[Length] != '\0')
Length++;
if (Length % 16 == 0)
Capacity = Length;
else
Capacity = (Length / 16 + 1) * 16;
Mem = new char[Capacity];
for (int i = 0; i < Length; i++)
Mem[i] = chArr[i];
}
I get an <error: expected ',' or '...' before 'chArr'> in the first line when compiling this. Is there a special way of naming array arguments? I don't get it...
String::String(const char[] chArr)
{
Length = 0;
while(chArr[Length] != '\0')
Length++;
if (Length % 16 == 0)
Capacity = Length;
else
Capacity = (Length / 16 + 1) * 16;
Mem = new char[Capacity];
for (int i = 0; i < Length; i++)
Mem[i] = chArr[i];
}