Hey guys, its past midnite so I think the programming ghoulies have gotten to me but I am having a very strange problem with a constructor Account(char c[], char num[], int b);
Everything runs fine until I reach the for loop below, which for a very strange and mind boggling reason does not execute and my program just crashes without any explanations and to make it run I need to include the printf("strlen(num): %d\n", j); statement.
Yes, I know I am using printf in C++ but thats what the prof wants so thats what the prof gets :)
int j = strlen(num) + 1;
/*
Copying to accountNumber
*/
//printf("Copying to accountNumber\n");
printf("strlen(num): %d\n", j);
for(int i = 0; i < j; i++)
{
accountNumber[i] = num[i];
//printf("accountNumber[%d] :: %c\n", i, num[i]);
}
accountNumber[15] = '\0';
/*
End copy to accoutNumber
*/
I have tried this on the Visual Studio compiler and the program crashes but with borland 5.0 it seems to work so if you have any insight into why this is happening please tell.