Hello,
I am writing a program in which user enters number of coordinates and then coordinate values, and then it enters number of queries and then queries, here is the partial code..
Now suppose i take Q as 2 then it only asks me once instead of asking twice...Code:#include<stdio.h> #include<stdlib.h> int main() { int i,j,Q; scanf("%d",&Q); int queries[Q][2]; char qtype[Q]; for(i=0; i<Q; i++) { //this portion is troubling...... scanf("%c %d %d",&qtype[i],&queries[i][0],&queries[i][1]); } printf("\n"); for(i=0; i<Q; i++) { printf("Query is %c %d %d\n",qtype[i],queries[i][0],queries[1]); } return 0; }
I want inputs to be
2 //value of Q
M 2 4
S 4 5
But it's not working as expected.. i can't figure out how to fix it...
**Thnx!!**



1Likes
LinkBack URL
About LinkBacks


