I'm trying to learn about string
s, but different sources tell my to include different headers.
Some say to use <string.h>
, but others mention "apstring.h"
. I was able to do some basic stuff with apstring
, but I've been told the other one is more powerful. When I include <string.h>
and try to declare some string variables, however, I get errors. What is the proper usage?
You want to include <string>
and use std::string
:
#include <string>
#include <iostream>
int main()
{
std::string s = "a string";
std::cout << s << std::endl;
}
But what you really need to do is get an introductory level book. You aren't going to learn properly any other way, certainly not scrapping for information online.