Hi, i got error in c program. the program is on arithmatic operation, in this output displaying properly, but when i press enter after seeing output then it will show me error like "stack around variable ch was corrupted"
below is my sample code
- #include
- #include
- void Add(int x,int y)
- {
- printf("%d",x+y);
- }
- void main()
- {
- int a;
- int b;
- char ch;
- scanf("%d",&a);
- scanf("%s",&ch);
- scanf("%d",&b);
- switch (ch)
- {
- case '+':
- Add(a,b);
- break;
- }
- getch();
- }
Abhijeet JadhavPosted Sep 29, 2019, 7:39 PM