114k views
0 votes
can help me biii and d? also help me check my answer is correct or not if wrong please help me correct it thanks​

can help me biii and d? also help me check my answer is correct or not if wrong please-example-1

1 Answer

3 votes

Answer:

b(ii) prices[1]= 20.50; // do not declare with double again

b (iii) scanf("%lf", &prices[4]); //prices[4] is last element

d) See below

Step-by-step explanation:

/* This program uses the string.h header file

The strncat() function in this file concatenates two strings. It takes three arguments, dest and source strings and number of characters to concatenate

*/

#include <stdio.h>
#include <string.h>

int main() {
char s1[10] = "Happy";
char s2[10] = " Birthday";
char s3[10]="";

strncat(s3, s1, 5); //concatenate 5 characters of s1 to end of s3 and
//store result in s3; s = "Happy"
strncat(s3, s2, 10); //concatenate s2 with current contents of s3
//s3 becomes "Happy Birthday
printf("%s", s3);

return 0;

}

User Nitya
by
4.9k points