Hello,
Is it legal to write
printf(" %+*.*f",5,0,A[r][c]);
Instead of
printf(" %+5.0f",A[r][c]);
Thank 10 1423
xhungab wrote:
Hello,
Is it legal to write
printf(" %+*.*f",5,0,A[r][c]);
Instead of
printf(" %+5.0f",A[r][c]);
Thank
Hi!
Yes it is for example with GNU C library as said in http://www.gnu.org/software/libc/man...atted%20Output.
But they also say "Other C library versions may not recognize this syntax."
Konstantin
xhungab wrote:
Hello,
Is it legal to write
printf(" %+*.*f",5,0,A[r][c]);
Instead of
printf(" %+5.0f",A[r][c]);
Thank
You mean with the + in it ? Looks yucky anyways. Why would you want to
do this like that?
Try invoking your compiler in C90 / C99 mode, depending on which
standard you want to adhere to, and enable strict/pedantic mode.
Sh
Schraalhans Keukenmeester wrote:
xhungab wrote:
>Hello,
Is it legal to write
printf(" %+*.*f",5,0,A[r][c]);
Instead of
printf(" %+5.0f",A[r][c]);
Thank
You mean with the + in it ? Looks yucky anyways. Why would you want to
do this like that?
Try invoking your compiler in C90 / C99 mode, depending on which
standard you want to adhere to, and enable strict/pedantic mode.
Sh
What is wrong with the + ?
kmi
Konstantin Miller wrote:
Schraalhans Keukenmeester wrote:
>xhungab wrote:
>>Hello,
Is it legal to write
printf(" %+*.*f",5,0,A[r][c]);
Instead of
printf(" %+5.0f",A[r][c]);
Thank
You mean with the + in it ? Looks yucky anyways. Why would you want to do this like that? Try invoking your compiler in C90 / C99 mode, depending on which standard you want to adhere to, and enable strict/pedantic mode.
Sh
What is wrong with the + ?
kmi
Nothing in particular, I just think it's bad coding style.
Either the actual width already is a positive and the + does not change
that, or it's a negative, in which case the + doesn't make it otherwise,
while a glimpse at the code may give the reader the suggestion it's a
positive value he/she is dealing with. As such, the + seams completely
useless here. Unless *I* have missed some other meaning of the + in this
example. In which case I'd stand corrected once you educate me further ;)
Kindest
Sh.
It is for this function.
In this way I can choose the format for any matrices.
void p_mR(
double **A,
int e,
int d
)
{
int r;
int c;
for(r=FIRST; r<A[R_SIZE][OF]; r++)
{
printf("\n");
for (c=FIRST; c<A[C_SIZE][OF]; c++)
printf(" %+*.*f",e,d,A[r][c]);
}
printf("\n\n");
}
Schraalhans Keukenmeester <fi********************@xsfourall.ennelwrote:
>printf(" %+*.*f",5,0,A[r][c]);
What is wrong with the + ?
Nothing in particular, I just think it's bad coding style.
Not so. It merely indicates the programmer's desire that the numeric
output always be preceded by a '+' or a '-' sign. It means the same
thing in
printf( "%+f", A[r][c] );
and may well produce exactly the behavior the programmer requires.
useless here. Unless *I* have missed some other meaning of the + in this
example. In which case I'd stand corrected once you educate me further ;)
You did :-)
--
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gmail.com | don't, I need to know. Flames welcome.
"xhungab" <xh*****@yahoo.frwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
It is for this function.
What is for this function? What do you mean by "it"?
>
In this way I can choose the format for any matrices.
void p_mR(
double **A,
int e,
int d
)
{
int r;
int c;
for(r=FIRST; r<A[R_SIZE][OF]; r++)
{
printf("\n");
for (c=FIRST; c<A[C_SIZE][OF]; c++)
printf(" %+*.*f",e,d,A[r][c]);
}
printf("\n\n");
}
The command :
printf(" %+*.*f",e,d,A[r][c]);
was for this function.
void p_mR(
double **A,
int e,
int d
)
{
int r;
int c;
for(r=FIRST; r<A[R_SIZE][OF]; r++)
{
printf("\n");
for (c=FIRST; c<A[C_SIZE][OF]; c++)
printf(" %+*.*f",e,d,A[r][c]);
}
printf("\n\n");
}
I use this function to print real matrices.
..
..
xhungab wrote:
Hello,
Is it legal to write
printf(" %+*.*f",5,0,A[r][c]);
Instead of
printf(" %+5.0f",A[r][c]);
Yes, it's standard printf() format syntax. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: pakkocool |
last post by:
¿Como ganar dinero en internet?
Lee atentamente el siguiente texto, es super interesante y te hara
ganar muchos dolares si sigues las instrucciones y le pones empeño:
Hace unos días que...
|
by: Chris Johnson |
last post by:
Greetings all:
I come across an interesting question (to me anyway) and I do not
know the answer. Code/Questions follow:
#include <iostream>
#if 0
// uncommenting *should* make call...
|
by: Nice |
last post by:
Hi.
I read somewhere that in XML the tag <xml> is not legal.
But in W3C specs I can't find this statement.
Does anyone know about it ?
|
by: mykidisgollum |
last post by:
Greetings,
I have code which prints a document who's attributes are saved as
flags in a database. One of the those attributes is letter or legal.
When I am printing, I use the following...
|
by: __PPS__ |
last post by:
Actually what I mean is that - if I have some memory buffer, lets say
char a; and then I do like this:
DWORD num = 0x1234;
*(DWORD*)a = num; (1)
*(DWORD*)(a+1) = num; (2)
either...
|
by: aj |
last post by:
I currently have 2 official DB2 Workgroup Edition
licenses for my 2 v8 production servers. I also have
tech support/software upgrade agreements in place
for both servers.
I am interested in...
|
by: Thomas Paul Diffenbach |
last post by:
I'm trying to write a space efficient string (nul terminated array
of char), storing the characters directly unless the number of
characters is too large to be so stored, and storing a pointer to...
|
by: Wiktor Zychla |
last post by:
is it legal to distribute axshdocvw, shdocvw and mshtml.dll with my
application?
is it legal to distribute Microsoft.mshtml.dll from 'Primary Interop
Assemblies' folder (I assume it comes with...
|
by: Alberto Giménez |
last post by:
Hi, I've seen some object oriented programming bits out there and i'm
not sure if they're legal. For example:
struct Object {
int field1;
int field2;
};
struct SubObject {
int field1; /*...
|
by: Army1987 |
last post by:
Is this program legal C89?
/* no headers included */
int main(void)
{
if (sizeof (exit(0), 0),
((void (* )(int))&exit)(
(puts((const char *)"hello, world"), 0)
),
0) {
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |