+ 3
11. O/P? point out if there is any mistake in program?
11. O/P? point out if there is any mistake in program? char* fun1(int aNum) { int d, end =4; char decimal[5]; int begin = 0; decimal[5] = '\0'; while(begin > end) { d = aNum % 10; decimal[begin++] = d + '0'; aNum = aNum / 10; } return decimal; } int main() { int num = 12345; printf("number %d after fun1() is called is s%", num, fun1(num)); }
1 Answer
+ 2
Make two changes
1. Make the character array decimal static
2. Change s% to %s in printf function.