Computer Science, asked by TbiaSamishta, 1 year ago

Find the output of the following after correcting the program? include “stdio.h” include “string.h” main () { char str[80] = “I like c” strcpy (str, “hello”) printf(str) ; }

Answers

Answered by Secondman
2

The correct form of the given code is as follows:

#include<stdio.h>

#include<string.h>

void main ()

{

char str[80] = “I like c”;

strcpy (str, “hello”);

printf(str) ;

}


OUTPUT: hello

The strcpy() function used in the above code is used to copy the content of string to other string.

In the above code, it has overwritten the initial value (i.e. """"I like c"""") from the string str and replaced it with """"hello"".

Now the content of str is “hello”

Similar questions