Answers for "c how to set a int in a char array"

C
1

c modify char array

char name_buf[5] = "Bob";
name_buf = "Alice";   // error
strcpy(name_buf, "Alice");
Posted by: Guest on August-24-2020
1

char array to int c

char myarray[5] = {'-', '1', '2', '3', '\0'};
int i;
sscanf(myarray, "%d", &i);
Posted by: Guest on March-29-2021

Code answers related to "C"

Browse Popular Code Answers by Language