My code is not taking input.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

My code is not taking input..

I have made a code which will insert elements in 2d array and then it will insert elements in rows if we want to do in any row.... And my problem is only that it is not taking inputs. https://code.sololearn.com/c30R8Ey0SO82/?ref=app

7th Feb 2020, 4:51 PM
Jayesh@2806 [ROYAL CODER]
Jayesh@2806 [ROYAL CODER] - avatar
8 Answers
+ 1
~ swim ~ Is That scanf is working fine..? Working only after some changes, for me.. I found 2 mistakes.. May be works in system without changes in scanf derective
7th Feb 2020, 6:14 PM
Jayakrishna 🇮🇳
+ 1
~ swim ~ With the array size, I think no problem, because he accessing upto m=2,n=2. But he is when not given the value to p<m. So segment error.. And taking input <m, but accessing <=m, so extra garbage values... For the sf derective, not working to take inputs... Changed to #define sf(x, y) scanf(x, y) p=0; i<m; //not i<=m; in last for loop, else m=p+m; I made these chages, then working fine...
7th Feb 2020, 6:31 PM
Jayakrishna 🇮🇳
+ 1
Jayakrishna my last loop includes a extra row that user will enter elements will be stored in that row
8th Feb 2020, 6:00 AM
Jayesh@2806 [ROYAL CODER]
Jayesh@2806 [ROYAL CODER] - avatar
+ 1
Jayakrishna i have just made changes check again
8th Feb 2020, 6:07 AM
Jayesh@2806 [ROYAL CODER]
Jayesh@2806 [ROYAL CODER] - avatar
+ 1
Jayakrishna i have written #define sf scanf
8th Feb 2020, 8:47 AM
Jayesh@2806 [ROYAL CODER]
Jayesh@2806 [ROYAL CODER] - avatar
0
Jayesh@2806 [ROYAL CODER] Yes. But you are not making it sure that p+1=m, anywhere. So If you give p value other than 1, It leading to overflow...
8th Feb 2020, 6:21 AM
Jayakrishna 🇮🇳
0
Jayesh@2806 [ROYAL CODER] Where you are running this? Is that sf derective working fine you there? Now, Only make sure p<m, otherwise it cause overflow... Remaining all Working fine..
8th Feb 2020, 6:52 AM
Jayakrishna 🇮🇳
0
Jayesh@2806 [ROYAL CODER] I saw it.. pf working but sf not working in my mobile without making to a function derective. but ~swim said working so I asked.. I mentioned sf changes for sf, I made in previous posts...
8th Feb 2020, 8:53 AM
Jayakrishna 🇮🇳