Why does printf give me this result ^*C? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Why does printf give me this result ^*C?

Hey, I'm just doing a tutorial and I'm wondering why its not working.
I need the user to enter two numbers in to an array and then take one away from the other!


int main(void) {
int numbers[2], result;
printf("Enter two numbers:");
scanf("%2s", &numbers[2]);
result = numbers[0] - numbers[1];
printf("%2s", result);

Sign In or Register to comment.