C | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C

#include <stdio.h> #include <conio.h> void main() { int *p1, *p2, sum; clrscr(); printf("Enter two numbers: "); scanf("%d%d", &*p1, &*p2); sum= *p1 + *p2; printf("sum=%d", sum); getch(); return 0; } Pls my code it’s not bringing out the expected output What is wrong with it,.,someone help me out pls

18th Feb 2022, 9:19 AM
Ejeh Wayne
Ejeh Wayne - avatar
6 Answers
+ 2
FF9900 <conio.h> header, void main() signature, clrscr() or getch() are all Turbo C/C++ stuffs, MS never admitted them in their standard.
18th Feb 2022, 12:09 PM
Ipang
+ 2
Remove all *
20th Feb 2022, 3:22 AM
follow ->
follow -> - avatar
+ 1
FF9900 what is MS specific stuff and SL?
18th Feb 2022, 10:01 AM
Ejeh Wayne
Ejeh Wayne - avatar
+ 1
FF9900 u took out the clscr and getch statements that is what makes it a pointer i guess i was told to work with them by instructor
18th Feb 2022, 10:05 AM
Ejeh Wayne
Ejeh Wayne - avatar
+ 1
FF9900 will the answer still be the same with conio.h and clscr and getch will it still output same result??
18th Feb 2022, 10:07 AM
Ejeh Wayne
Ejeh Wayne - avatar
+ 1
G'day Ejeh Wayne you say you were told to use pointers, so best you learn a bit about them. I'm still learning, but there are many users here that are proficient. Did you know, you can post SoloLearn "code bits" in the Q&A forum, it makes checking operation much easier for other commenters.
18th Feb 2022, 12:23 PM
HungryTradie
HungryTradie - avatar