Question
The function void strncat (char destination[], const char source[], int num) appends the first num characters of source to destination , plus a terminating null-character.
void strncat (char destination[], const char source[], int num)
appends the firstnumcharacters ofsourcetodestination, plus a terminating null-character. If the length of the C string in source is less thannum, only the content up to the terminating null-character is copied.
Write the function strncat:
Write the call to the strncat function so that the contents insrcis safely appended todest.
#include
const int MAXDESTINATION = 40;
const int MAXSOURCE = 150;
int main()
{
char dest[MAXDESTINATION+1] = "It don't mean a thing";
char src[MAXSOURCE+1] = " if it don't got the Go-Go swing!";
int a = strlen(dest);
int b = strlen(src);
// Your code would go here
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started