I want to assign a string like: "22 33" to a variable like char*av[129]. How can i do that in C/C++?
1 Answer
strcpy(av[0], "22 33");
IF you know av[0] is long enough (length of string you want to put in plus one for the NUL).
Otherwise, use strncpy.
1 Comment
ugoren
He should always use
strncpy, even only as a good habit. Also, it won't solve his problem if the buffer isn't long enough - it would just change the bug, perhaps to a friendlier one.