How to update a char[] with string variables?

How to update a char[] with string variables?

sprintf(char, %s, string) doesn't work

Other urls found in this thread:

cdecl.org/
ideone.com/SpiJRX
twitter.com/NSFWRedditGif

a char[] is a string variable

You sure you don't want a char *var[] ?
var[0] = "Read a fucking book"

looks like char *var[] works ty

what's the different between char *var[] and char var[]?

kill yourself brainlet

but what's the different before i kill myself?

cdecl.org/

>tfw brainlet
whats a pointer i only know java

>does not know the difference
>calls others brainlets

String[] char = {"op","a","faggot"}

just std::cin >> char;

one is an array of chars, the other is an array of arrays of chars that's also reassignable

>sprintf(char, %s, string)
What the fuck are you doing, nigger?

char var[]; // an array of char's
char* var[]; // an array of char*'s

char * op = malloc(20);
sprintf(op, "op is a %s", "faggot");
while(op)
printf("%c\n",++op);

Is this the stupid questions thread?
oWo
char *pname = player->name;
*(pname++)
*(player->name++)

What is the difference between the last two lines and why the last one fails to do the same job as the second last line?

Not sure how it fails but maybe you are fucking up the name pointer. if the name is john, the pointer would point to j but if you increment the pointer the name would then point to o. By using another pointer (aka pname) you avoid this.

They should have the same result.
Hopefully this will help you see what is happening.
ideone.com/SpiJRX

char *cstr = &myStringVariable[0u];

Idk, just throwin' some shit out there. I've used this in cases where I have a string that I'd like to dynamically convert into a c-string

Wouldn't you do something like:
char mystring[20];

for ( int i = 0; i < sizeof(mystring); i++) {
mystring[i] = 'x'
}


Been a while since I've used microcontrollers