Beginner C/C++

Moderators: None (Apply to moderate this forum)
Number of threads: 5428
Number of posts: 16949

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Why does printf give me this result ^*C? Posted by the5thace on 14 Nov 2012 at 6:23 AM

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!

#include <stdio.h>


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

}
Report
Re: Why does printf give me this result ^*C? Posted by Pelle-48 on 20 Nov 2012 at 1:56 AM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.