Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Weird usage of printf/scanf? Why do they work?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="James Kuyper, post: 3936155"] Meske Moday wrote: .... This program generated precisely the expected warning message when compiled on my machine: ~/testprog(55) gcc -ansi -pedantic -Wall prog-2-1.c -o prog-2-1 prog-2-1.c: In function ‘main’: prog-2-1.c:23: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast The executable failed in one of the most plausible ways I might have expected: ~/testprog(56) prog-2-1 Enter an integer: 5 Segmentation fault I would expect similar results from the other two assignments. The simplest way I can imagine for such code to compile without warning messages, and to execute in accordance with requirements, as you said it did for you, is if someone has fiddled with the contents of <stdio.h>. However, reality has a better imagination than I do, so it may be something else. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Weird usage of printf/scanf? Why do they work?
Top