answersLogoWhite

0


Best Answer

The strcat() function has the following protocol:

char* strcat (char* destination, char* source);

The function appends the source string to the destination string and returns the destination string.

The destination string must be a null-terminated character array of sufficient length to accommodate strlen (source) plus strlen (destination) characters, plus a null-terminator. The existing null-terminator and subsequent characters of destination are overwritten by characters from the source string, up to and including the source string's null-terminator.

strcat (string, '!') will not work because '!' is a character literal (ASCII code 33 decimal), not a null-terminated character array. Use "!" instead of '!'.

Example:

char string[80]; // character array

strcpy (string, "Hello world");

strcat (string, "!");

puts (string);

User Avatar

Wiki User

7y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why strcat(string'!') not work in C program?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you make an employee database in c program?

With lots of hard work.


How do you link a C plus plus program to C functions?

It should work without any special action.


How do you install mods in Call of Duty 1?

Set in it a map And then place it in C:/program filles/Call of Duty If it not work try this C:/program filles/Call of Duty/main


Features of c program?

the features of a C program


C program was introduced in the year?

c program was introduced in the year 1972 by Dennis RitchieNo, it was the C language, not the C program.


What possible problems could mixing the 2 languages in a C program cause the programmer?

Well, if you mix C-language with PHP (for example), the resulting "program" won't work in any of the two.


What is executive a c program?

I think it is 'execution of a C program'.


C program on left factoring in compiler design?

how to create a c program for left factoring.


Is C programming works without assembler compiler interpreter?

No, a C program cant work without an interpreter or compiler or assembler as the code written in the program is not understood directly by the computer so it needs any of the above translator program to make the program understandable to the computer.-Shruti Jain


How a c compiler work?

compiler is just translator it translates the our source program to equivalent langauage,so computer can easily understand and compile that program efficiently................


Program for sin series in c language?

find the program in c-pgms.blogspot.com


Different parts of c language program?

what are the parts of C language program