Ask your own question, for FREE!
Computer Science 20 Online
OpenStudy (anonymous):

strlen, strcpy, strcat, strncpy, atoi please explain the function of these commands in c programming?

OpenStudy (anonymous):

The strlen() function calculates the length of the string s, not including the terminating '\0' character. The strcpy() function copies the string pointed to by src, including the terminating null byte ('\0'), to the buffer pointed to by dest. The strings may not overlap, and the destination string dest must be large enough to receive the copy. The strncpy() function is similar, except that at most n bytes of src are copied. Warning: If there is no null byte among the first n bytes of src, the string placed in dest will not be null terminated. The strcat() function appends the src string to the dest string, over- writing the null byte ('\0') at the end of dest, and then adds a termi- nating null byte. The strings may not overlap, and the dest string must have enough space for the result. The atoi() function converts the initial portion of the string pointed to by nptr to int. The behavior is the same as strtol(nptr, (char **) NULL, 10); except that atoi() does not detect errors. IF you have access to a Linux terminal you can always type man 3 and the command ie.. man 3 strlen and the programmer manual page will pop up with the function definition.

OpenStudy (anonymous):

prototypes int atoi(const char *nptr); size_t strlen(const char *s); char *strcat(char *dest, const char *src); char *strcpy(char *dest, const char *src); char *strncpy(char *dest, const char *src, size_t n);

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!