1.

#include<iostream>#include<cstdlib>using namespace std; int main() {char str1 [] = “123”,str2[] = “45”; int a,b; a = atoi(str1); b = atoi(str2); cout<<a+b;}What will be the output and give the reason?

Answer»

The output is 123 + 45 = 168. Here the conversion function atoi is used to convert the string “123” into integer 123 and “45” into integer 45 so the result.



Discussion

No Comment Found

Related InterviewSolutions