Fix the following C program in linux When it is compiled it
Fix the following C program in linux. When it is compiled it gives the following error: warning cast to pointer from integer of different size.
Solution
#ifndef endLocation
#define endLocation
#include \"myLinkedlist.h\"
#include \"myString.h\"
class endLocation
can use atoi
int travelCost; // can use atoi
public:
endLocation();
endLocation(String, int, int);
endLocation(endLocation& rhs);
void setName(String);
void setTime(int);
void setCost(int);
String getName();
int getTime();
int getCost();
};
#endif // endLocation
//.cpp implementation
endLocation::endLocation()
endLocation::endLocation(endLocation& rhs)
void endLocation::setName(String inputName)
void endLocation::setTime(int inputTime)
void endLocation::setCost(int inputCost)
String endLocation::getName()
come locationName;
}
int endLocation::getTime()
come travelTime;
}
int endLocation::getCost()
come travelCost;
}
Here is my main
int main( int argc, char* const argv[] )
range of lines here
for(int i = 0; i < num_lines; ++i)dissect and store all strings
size = findIndex(line, \'|\');
strncpy(name, line, size);
index = size + 1;
size = findIndex(line + index, \'|\');
strncpy(time, line + index, size);
index += size + 1;
size = findIndex(line + index, \'|\');
strncpy(cost, line + index, size);
}
in.close();
}
else

