#include int main ( ){//3 ways of declaring and initializing stringschar stringl1 [10] = {"Welcome"};char string2 [] = {'W','e', 'l','c','o','m','e','\O'};char string3 [] = "Good Bye";printf...


3.1. The program shows how to declare, initialize and display strings. Type, compile and run the<br>program. [Note : The function “sizeof
#include int main ( ) { //3 ways of declaring and initializing strings char stringl1 [10] = {"Welcome"}; char string2 [] = {'W','e', 'l','c','o','m','e','\O'}; char string3 [] = "Good Bye"; printf ("\nDisplay content of string1 : %s",string1); printf ("\nDisplay content of string2 : %s",string2); printf ("\nDisplay content of string3 : %s",string3) ; //size of stringl printf ("\n\nSize of string1 is %d",sizeof (stringl)); //size of string2 printf ("\nsize of string2 is %d",sizeof (string2)); //size of string3 printf ("\nSize of string3 is %d",sizeof (string3)) ; //length of string1 printf ("\n\nLength of string1 is %d",strlen (string1)); //length of string2 printf ("\nLength of string2 is %d",strlen(string2)); //length of string3 printf ("\nLength of string3 is %d\n", strlen(string3) ) ; return 0; a. Write the output of the program. b. Comment on the differences in strings size and length in your output. "/>
Extracted text: 3.1. The program shows how to declare, initialize and display strings. Type, compile and run the program. [Note : The function “sizeof" is to get the variable size in term of byte and the function “strlen" is to find the length of the string] #include #include int main ( ) { //3 ways of declaring and initializing strings char stringl1 [10] = {"Welcome"}; char string2 [] = {'W','e', 'l','c','o','m','e','\O'}; char string3 [] = "Good Bye"; printf ("\nDisplay content of string1 : %s",string1); printf ("\nDisplay content of string2 : %s",string2); printf ("\nDisplay content of string3 : %s",string3) ; //size of stringl printf ("\n\nSize of string1 is %d",sizeof (stringl)); //size of string2 printf ("\nsize of string2 is %d",sizeof (string2)); //size of string3 printf ("\nSize of string3 is %d",sizeof (string3)) ; //length of string1 printf ("\n\nLength of string1 is %d",strlen (string1)); //length of string2 printf ("\nLength of string2 is %d",strlen(string2)); //length of string3 printf ("\nLength of string3 is %d\n", strlen(string3) ) ; return 0; a. Write the output of the program. b. Comment on the differences in strings size and length in your output.
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here