-1
I want to enter a sequence of 21 numbers and save it in an array, and after that I want to print the sequence I saved in the array.
This is my code:
void testa_nib () {
int i=0,c=0;
int nib[21];
for (i=0;i<22;i++) {
c=getchar();
c=c-'0';
nib[i] = c;
}
for (i=0;i<=21;i++){
printf ("%d",nib[i]);
}
int main() {
testa_nib();
return 0;
}
This is my input:
123443211234567890127
This is my output:
-38123443211234567890127
Welcome to SOPT. :) Please translate your question, this is a community in Portuguese, or consider posting on the English site.
– bruno101
I thought you weren’t at SOPT, sorry
– TBOTL