Re: Help in C code snippet !

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Soorej P wrote:
> unsigned int a;
> a=2147483698;
> printf ("size= %d\n", a);


change to

  printf ("size= %ud\n", a);

and you will get the right answer

> 
> +++++++++++
> OUTPUT
> +++++++++++
> test.c:5: warning: this decimal constant is unsigned only in ISO C90
> [root@ddd cfiles]# ./a.out
> size= -2147483598
> 
> Y? .. since unsigned int should hold value up to 4294967295..
> 
> --Soorej

either way I get a warning:

warning: this decimal constant is unsigned only in ISO C90

Mark

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux