|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Getting warning message during compilation but not during execution I am having problem compiling my following program: Code: # include <stdio.h> int main() { char x[]="Amar",y[]="Akbar",z[]="Anthony"; printf ("%u\n",x); printf ("%u\n",&y[0]); printf ("%u\n",&z[0]); } |
#2
| |||
| |||
Re: Getting warning message during compilation but not during execution You are getting that warning message only because of "%u" which is used for "unsigned int". Use "%s" instead to avoid this warning message. The compiler is telling you that you are using "%u" although you are passing characters. Also one more thing, this kind of warning messages are left unconsidered during execution and so you are not getting the warning messages at the time of execution. |
#3
| |||
| |||
Re: Getting warning message during compilation but not during execution What are you trying to print? If you want addresses of that variables then use "&" and if not then use "%c" or "%s" as below: Code: printf ("%c\n",&x); printf ("%c\n",&y[0]); printf ("%c\n",&z[0]); Code: printf ("%s\n",x); printf ("%s\n",y[0]); printf ("%s\n",z[0]); |
#4
| |||
| |||
Re: Getting warning message during compilation but not during execution I suppose you are trying to print variables addresses in decimal format rather than displaying them in hexadecimal format. If this is the case then I would recommend you should use typecasting as below: Code: printf("%llu",(unsigned long long)variable_name); |
![]() |
|
Tags: compilation, execution, warning |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Bios warning message on MSI Eclipse SLI | P@poY!! | Motherboard Processor & RAM | 2 | 13-05-2012 10:25 AM |
Norton 360 backup warning message again | Tamas | Networking & Security | 6 | 22-09-2010 12:03 AM |
Get 'Data Execution Prevention' warning in Internet Explorer 8 | Anwar | Technology & Internet | 6 | 31-07-2009 02:47 AM |
Warning Message : Error Code 1 | Clemens | Operating Systems | 3 | 28-02-2009 06:29 PM |
USB shows warning message | JamesB | Hardware Peripherals | 4 | 26-02-2009 06:32 PM |