hi all i have a quick question, how do i convert a char into another char such as:
char name, name2;
name="bobo";
name2=name;
Any help would be great.. im thinking it has something to do with the string.h include.
hi all i have a quick question, how do i convert a char into another char such as:
char name, name2;
name="bobo";
name2=name;
Any help would be great.. im thinking it has something to do with the string.h include.
No it has to do with the C book that's gathering dust on your shelf.im thinking it has something to do with the string.h include.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
Dude, you're confused. Those variables declared are only single characters. Not full words. So the following would not work:To fix this do this:Code:char name, name2; name="bobo"; name2=name;Code:char name[100]; // an array of 100 little characters to make up a whole word or sentence char name2[100]; // same as above strcpy(name, "bobo"); // assign the string "bobo" to name strcpy(name2, name); // now assign whatever is in name to name2
Its also okay to do any of the following
Code://example 1 char name[]="bobo", *name2=name; //example 2 char *name="bobo", *name2=name; //example 3 char name[10] = "bobo", *name2=name; //example 4 char name[10] = "bobo", name2[10]; strcpy(name2, name); //there are other variations but you get the idea