Question: Find the error in each of the following program segments and explain how to correct it: a) char s [10]; strncpy (s, hello, 5); printf
Find the error in each of the following program segments and explain how to correct it: a) char s [10]; strncpy (s, "hello", 5); printf (" %s ",s); b) printf ("%s", 'a'); c) char s [12]; strcpy (s, "Welcome Home"); d) if (strcmp (string1, string2)) {printf ("The strings are equal ");} write code to accomplish each of the following: a) Define a structure called part containing int variable partNumber and char array partName with values that may be as long as 25 characters (including the terminating null character). b) Declare variable a to be of type struct part, array b [10] to be of type struct part. c) Read a part number and a part name from the keyboard into the individual members of variable a, which declared in b). (Note that partName is a char array with 25 elements.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
