M
muser
The following error appears: 'strcmp' : cannot convert parameter 1
from 'char' to 'const char *'. I've already tried using single
quotations. the header file
only contains the struct contents. The whole program is part of an
example found in my course work. Does strcmp only compare two sets of
strings or can it be used to determine the end of the string as well?
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include "program2v.h"
using namespace std;
int main()
{
crecord *string1, *string2, t_str;
*string1 = t_str;
/// the error while( strcmp(*string1->customername, "\0"))
{
*string2 = *string1 + 1;
while( strcmp(*string2->customername, '\0'))
{
if(strcmp( *string1->customername, *string2->customername) > 0 )
{
t_str = *string1;
*string1 = *string2;
*string2 = t_str;
}
string2++;
}
string1++;
}
return 0;
}
from 'char' to 'const char *'. I've already tried using single
quotations. the header file
only contains the struct contents. The whole program is part of an
example found in my course work. Does strcmp only compare two sets of
strings or can it be used to determine the end of the string as well?
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include "program2v.h"
using namespace std;
int main()
{
crecord *string1, *string2, t_str;
*string1 = t_str;
/// the error while( strcmp(*string1->customername, "\0"))
{
*string2 = *string1 + 1;
while( strcmp(*string2->customername, '\0'))
{
if(strcmp( *string1->customername, *string2->customername) > 0 )
{
t_str = *string1;
*string1 = *string2;
*string2 = t_str;
}
string2++;
}
string1++;
}
return 0;
}