#include <stdio.h> #include <stdlib.h> main() { char string 1 [4], string 2 [10]
ID: 3612999 • Letter: #
Question
#include <stdio.h> #include <stdlib.h> main() { char string 1 [4], string 2 [10] foat num; scanf( " %3 s % 4 f% s ", string 1, & num, string2); return Exit_sucess; } what are the contents of string 1, string 2, and num, whenprogram receive an input of ABC1.23 pqr34 ? #include <stdio.h> #include <stdlib.h> main() { char string 1 [4], string 2 [10] foat num; scanf( " %3 s % 4 f% s ", string 1, & num, string2); return Exit_sucess; } what are the contents of string 1, string 2, and num, whenprogram receive an input of ABC1.23 pqr34 ?Explanation / Answer
please rate - thanks assuming you meant this #include #include #include int main() { char string1[4], string2[10]; float num; scanf( "%s%f%s", &string1, &num, &string2); getch(); return 0; } since the values entered are seperated by spaces, and charactersaren't counted string1 which has 4 characters will overflow and will have ABC1.23in it num will read pqr34 as a float number and string2 will havegarbage sample program and run #include #include #include int main() { char string1[4], string2[10]; float num; scanf( "%s%f%s", &string1, &num, &string2); printf("%s %f %s ", string1, num,string2); getch(); return 0; } sample run ABC1.23 pqr34 ABC1.23 1415991098225737600000000000000000.000000 -¿îv¦?¦Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.