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.

The function

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!