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.
This is a discussion on char = char? within the C++ Programming forums, part of the General Programming Boards category; hi all i have a quick question, how do i convert a char into another char such as: char name, ...
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:int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000 <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000 )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 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
Please direct all complaints regarding this post to the nearest brick wallHave a nice day.
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