Connecting Tech Pros Worldwide Forums | Help | Site Map

Bug in list of matrics represended as arays.....

Djuro.Tost@gmail.com
Guest
 
Posts: n/a
#1: Jul 3 '08
The problem is how to print matrics....
If you are from croatia pldease don't answer mee...

// lista_matrica.cpp : Defines the entry point for the console
application.
//

#include "stdafx.h"
#include<stdio.h>
#include<malloc.h>

int ispisi(int *, int, int);

struct matrica{
int m;
int n;
int *A;
struct matrica *next;
};


int main(void)
{ int i, j, k, nn, mm;
int *matr;
char c='d';
struct matrica *pravi_prvi, *prvi, *tekuci;
prvi=(struct matrica*)malloc(sizeof(struct matrica));
tekuci=prvi;
ulaz:
printf("\nEnter a dimensions");
printf(" N=");
scanf("%d",&nn);
printf("\nM=");
scanf("%d",&mm);
tekuci->A=(int *)malloc(sizeof(int)*mm*nn);
tekuci->n=nn;
tekuci->m=mm;
for(i=0;i<nn;i++){
for(j=0;j<mm; j++){
printf("\nA[%d,%d]=",i,j);
scanf("%d",&k);
tekuci->A[i*nn+j]=k;
}
}
printf("\nNext (y/n)");
scanf("%c",&c);
scanf("%c",&c);
if(c!='y') goto izlaz;
else{
tekuci->next=(struct matrica*)malloc(sizeof(struct matrica));
tekuci=tekuci->next;
tekuci->next=NULL;
goto ulaz;
}
izlaz:
tekuci=prvi;
while(tekuci){
ispisi(tekuci->A,tekuci->n,tekuci->m);
tekuci=tekuci->next;
}

return 0;
}



int ispisi(int *A, int nn, int mm){
int i, j;
printf("\n----------------------------\n");
for(i=0;i<nn;i++){
printf("\n");
for(j=0;j<mm;j++){
printf("A[%d,%d]=%d\t%d",i,j, A[i*nn+j],i*nn+j);//here is a bug
when j=0
}
}
return 0;
}

Djuro.Tost@gmail.com
Guest
 
Posts: n/a
#2: Jul 3 '08

re: Bug in list of matrics represended as arays.....




Djuro.T...@gmail.com je napisao/la:
Quote:
The problem is how to print matrics....
If you are from croatia pldease don't answer mee...
>
// lista_matrica.cpp : Defines the entry point for the console
application.
//
>
#include "stdafx.h"
#include<stdio.h>
#include<malloc.h>
>
int ispisi(int *, int, int);
>
struct matrica{
int m;
int n;
int *A;
struct matrica *next;
};
>
>
int main(void)
{ int i, j, k, nn, mm;
int *matr;
char c='d';
struct matrica *pravi_prvi, *prvi, *tekuci;
prvi=(struct matrica*)malloc(sizeof(struct matrica));
tekuci=prvi;
ulaz:
printf("\nEnter a dimensions");
printf(" N=");
scanf("%d",&nn);
printf("\nM=");
scanf("%d",&mm);
tekuci->A=(int *)malloc(sizeof(int)*mm*nn);
tekuci->n=nn;
tekuci->m=mm;
for(i=0;i<nn;i++){
for(j=0;j<mm; j++){
printf("\nA[%d,%d]=",i,j);
scanf("%d",&k);
tekuci->A[i*nn+j]=k;
}
}
printf("\nNext (y/n)");
scanf("%c",&c);
scanf("%c",&c);
if(c!='y') goto izlaz;
else{
tekuci->next=(struct matrica*)malloc(sizeof(struct matrica));
tekuci=tekuci->next;
tekuci->next=NULL;
goto ulaz;
}
izlaz:
tekuci=prvi;
while(tekuci){
ispisi(tekuci->A,tekuci->n,tekuci->m);
tekuci=tekuci->next;
}
>
return 0;
}
>
>
>
int ispisi(int *A, int nn, int mm){
int i, j;
printf("\n----------------------------\n");
for(i=0;i<nn;i++){
printf("\n");
for(j=0;j<mm;j++){
printf("A[%d,%d]=%d\t%d",i,j, A[i*nn+j],i*nn+j);//here is a bug
when j=0
}
}
return 0;
}


Maybe shorter question is how to print a matrics represented as
arrays...

Thanks in advance, Robert...;)
Richard Bos
Guest
 
Posts: n/a
#3: Jul 3 '08

re: Bug in list of matrics represended as arays.....


Djuro.Tost@gmail.com wrote:
Quote:
If you are from croatia pldease don't answer mee...
*Plonk*

Richard
Jens Thoms Toerring
Guest
 
Posts: n/a
#4: Jul 3 '08

re: Bug in list of matrics represended as arays.....


Djuro.Tost@gmail.com wrote:
Quote:
The problem is how to print matrics....
If you are from croatia pldease don't answer mee...
I hope very much that with this sentence you destroyed any
chance of getting an answer here.

--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
Djuro.Tost@gmail.com
Guest
 
Posts: n/a
#5: Jul 3 '08

re: Bug in list of matrics represended as arays.....




Jens Thoms Toerring je napisao/la:
Quote:
Djuro.Tost@gmail.com wrote:
Quote:
The problem is how to print matrics....
If you are from croatia pldease don't answer mee...
>
I hope very much that with this sentence you destroyed any
chance of getting an answer here.
>
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
Whenewer I put something on croatian news group they hurt mee
wery much so this is a reason why I don't want any help from
croatia...

Thanks, Robert...;)
CBFalconer
Guest
 
Posts: n/a
#6: Jul 3 '08

re: Bug in list of matrics represended as arays.....


Djuro.Tost@gmail.com wrote:
Quote:
>
The problem is how to print matrics....
If you are from croatia pldease don't answer mee...
>
// lista_matrica.cpp : Defines the entry point for the console
Assumes you have a C99 compiler.
Quote:
application.
illegal syntax
Quote:
//
>
#include "stdafx.h"
File not shown. No idea what it contains.
Quote:
#include<stdio.h>
Missing blank after #include
Quote:
#include<malloc.h>
No such header file in standard C. Probably wants stdlib.h

Since in the first 7 lines, we find at least 4, probably 5, errors,
it seems pointless to read further. Note that I have counted
errors only once, even though the same error was repeated.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.


Harald van =?UTF-8?b?RMSzaw==?=
Guest
 
Posts: n/a
#7: Jul 3 '08

re: Bug in list of matrics represended as arays.....


On Thu, 03 Jul 2008 12:01:59 -0400, CBFalconer wrote:
Quote:
Djuro.Tost@gmail.com wrote:
Quote:
>#include<stdio.h>
>
Missing blank after #include
There's nothing invalid about that, and it's considered bad style by some,
but not all.
Keith Thompson
Guest
 
Posts: n/a
#8: Jul 3 '08

re: Bug in list of matrics represended as arays.....


CBFalconer <cbfalconer@yahoo.comwrites:
Quote:
Djuro.Tost@gmail.com wrote:
Quote:
>>
>The problem is how to print matrics....
>If you are from croatia pldease don't answer mee...
>>
>// lista_matrica.cpp : Defines the entry point for the console
>
Assumes you have a C99 compiler.
Yes, perhaps he does. Or, more likely, he has a non-C99 compiler that
supports "//" comments as an extension.
Quote:
Quote:
>application.
>
illegal syntax
A result of the line being wrapped somewhere between his newsreader
and ours. This can be avoided by not using "//" comments when posting
to Usenet.
Quote:
Quote:
>//
>>
>#include "stdafx.h"
>
File not shown. No idea what it contains.
Not portable, but not an error.
Quote:
Quote:
>#include<stdio.h>
>
Missing blank after #include
The blank is not required. I do agree that the blank is better style
and makes the line more readable, but it's certainly not an error.
Quote:
Quote:
>#include<malloc.h>
>
No such header file in standard C. Probably wants stdlib.h
Agreed. (But it's likely that his implementation provides a
<malloc.hheader, and using it, though not wise, isn't necessarily an
error.)
Quote:
Since in the first 7 lines, we find at least 4, probably 5, errors,
it seems pointless to read further. Note that I have counted
errors only once, even though the same error was repeated.
Most of the errors you counted weren't errors.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Default User
Guest
 
Posts: n/a
#9: Jul 3 '08

re: Bug in list of matrics represended as arays.....


Djuro.Tost@gmail.com wrote:
Quote:
Whenewer I put something on croatian news group they hurt mee
wery much so this is a reason why I don't want any help from
croatia...
This is not a Croatian newsgroup. Your post was offensive and you
deserve no assistance, although I see a few have given you some anyway.




Brian
CBFalconer
Guest
 
Posts: n/a
#10: Jul 4 '08

re: Bug in list of matrics represended as arays.....


Keith Thompson wrote:
Quote:
CBFalconer <cbfalconer@yahoo.comwrites:
>
.... snip ...
Quote:
>
Agreed. (But it's likely that his implementation provides a
<malloc.hheader, and using it, though not wise, isn't necessarily
an error.)
>
Quote:
>Since in the first 7 lines, we find at least 4, probably 5, errors,
>it seems pointless to read further. Note that I have counted
>errors only once, even though the same error was repeated.
>
Most of the errors you counted weren't errors.
Since the point of my post was to impress the extent of his
'errors' upon the newbie, why do people have to immediately degrade
any such impression? And <malloc.h_is_ an error. It makes the
source depend on things not prescribed by the C standard. All you
are saying is that it may not get detected.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.


Richard Heathfield
Guest
 
Posts: n/a
#11: Jul 4 '08

re: Bug in list of matrics represended as arays.....


CBFalconer said:
Quote:
Keith Thompson wrote:
Quote:
>CBFalconer <cbfalconer@yahoo.comwrites:
>>
... snip ...
Quote:
>>
>Agreed. (But it's likely that his implementation provides a
><malloc.hheader, and using it, though not wise, isn't necessarily
>an error.)
>>
Quote:
>>Since in the first 7 lines, we find at least 4, probably 5, errors,
>>it seems pointless to read further. Note that I have counted
>>errors only once, even though the same error was repeated.
>>
>Most of the errors you counted weren't errors.
>
Since the point of my post was to impress the extent of his
'errors' upon the newbie, why do people have to immediately degrade
any such impression?
Because it's wrong. If they're not errors, why call them errors?
Quote:
And <malloc.h_is_ an error.
No, it isn't. It's just non-portable and off-topic. That's not quite the
same thing as an error.
Quote:
It makes the source depend on things not prescribed by the C standard.
So do lots of things. That doesn't make those things errors. For example,
the C standard doesn't prescribe that implementations' source character
sets must support the '@' character - but lots do (I actually know of none
that don't), and a fair amount of source code depends on the '@' character
being supported. To call that an "error" would be stretching the term
further than is useful.
Quote:
All you are saying is that it may not get detected.
Compilers can't always catch genuine errors, let alone made-up ones.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Djuro.Tost@gmail.com
Guest
 
Posts: n/a
#12: Jul 4 '08

re: Bug in list of matrics represended as arays.....




CBFalconer je napisao/la:
Quote:
Keith Thompson wrote:
Quote:
CBFalconer <cbfalconer@yahoo.comwrites:
... snip ...
Quote:

Agreed. (But it's likely that his implementation provides a
<malloc.hheader, and using it, though not wise, isn't necessarily
an error.)
Quote:
Since in the first 7 lines, we find at least 4, probably 5, errors,
it seems pointless to read further. Note that I have counted
errors only once, even though the same error was repeated.
Most of the errors you counted weren't errors.
>
Since the point of my post was to impress the extent of his
'errors' upon the newbie, why do people have to immediately degrade
any such impression? And <malloc.h_is_ an error. It makes the
source depend on things not prescribed by the C standard. All you
are saying is that it may not get detected.
>
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
But the programm works compiled with Visual Studio 6.0,
and #include "stdafx.h" is needed...
The only problem is how to print a matric represented as array..

Thanks, Robert...;)
Djuro.Tost@gmail.com
Guest
 
Posts: n/a
#13: Jul 4 '08

re: Bug in list of matrics represended as arays.....




Richard Heathfield je napisao/la:
Quote:
CBFalconer said:
>
Quote:
Keith Thompson wrote:
Quote:
CBFalconer <cbfalconer@yahoo.comwrites:
>
... snip ...
Quote:
>
Agreed. (But it's likely that his implementation provides a
<malloc.hheader, and using it, though not wise, isn't necessarily
an error.)
>
>Since in the first 7 lines, we find at least 4, probably 5, errors,
>it seems pointless to read further. Note that I have counted
>errors only once, even though the same error was repeated.
>
Most of the errors you counted weren't errors.
Since the point of my post was to impress the extent of his
'errors' upon the newbie, why do people have to immediately degrade
any such impression?
>
Because it's wrong. If they're not errors, why call them errors?
>
Quote:
And <malloc.h_is_ an error.
>
No, it isn't. It's just non-portable and off-topic. That's not quite the
same thing as an error.
>
Quote:
It makes the source depend on things not prescribed by the C standard.
>
So do lots of things. That doesn't make those things errors. For example,
the C standard doesn't prescribe that implementations' source character
sets must support the '@' character - but lots do (I actually know of none
that don't), and a fair amount of source code depends on the '@' character
being supported. To call that an "error" would be stretching the term
further than is useful.
>
Quote:
All you are saying is that it may not get detected.
>
Compilers can't always catch genuine errors, let alone made-up ones.
>
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
But the program works with Visual studio , the:#include "stdafx.h"
is needeed, the only problem is how to print matric represented
as array....

Thanks, Robert...;)
Richard Heathfield
Guest
 
Posts: n/a
#14: Jul 4 '08

re: Bug in list of matrics represended as arays.....


Djuro.Tost@gmail.com said:

<snip>
Quote:
But the programm works compiled with Visual Studio 6.0,
and #include "stdafx.h" is needed...
No, it isn't. I have Visual Studio 6.0, and I have used it to write and
compile thousands of programs, not one of which included that file, so I
can guarantee that it's not needed - *provided* you know how to set your
project up properly.
Quote:
The only problem is how to print a matric represented as array..
I'd have thought that the immediate problem is that of learning how to set
up a project properly so as not to need spurious headers and misleading
file extensions. It isn't difficult. Once you've mastered that, you'll
find C a lot less confusing. Right now, you're trying to program in a
mixture of ISO C and Microsoft C++, seemingly without even realising it.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Richard Heathfield
Guest
 
Posts: n/a
#15: Jul 4 '08

re: Bug in list of matrics represended as arays.....


Djuro.Tost@gmail.com said:

<snip>
Quote:
But the program works with Visual studio , the:#include "stdafx.h"
is needeed,
No, it isn't.
Quote:
the only problem is how to print matric represented as array....
No, it isn't.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Djuro.Tost@gmail.com
Guest
 
Posts: n/a
#16: Jul 4 '08

re: Bug in list of matrics represended as arays.....




Richard Heathfield je napisao/la:
Quote:
Djuro.Tost@gmail.com said:
>
<snip>
>
Quote:
But the program works with Visual studio , the:#include "stdafx.h"
is needeed,
>
No, it isn't.
>
Quote:
the only problem is how to print matric represented as array....
>
No, it isn't.
>
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999

I use a gcc where #include "stdafx.h"is not needeed,
but Visual Studio wants #include "stdafx.h"....
You coud put him in coment and try to commpile...

Thanks, Robert...;)
My Question is how to print a matric represented as array...
Antoninus Twink
Guest
 
Posts: n/a
#17: Jul 4 '08

re: Bug in list of matrics represended as arays.....


On 4 Jul 2008 at 6:10, Djuro.Tost@gmail.com wrote:
Quote:
Richard Heathfield je napisao/la:
Quote:
>Djuro.Tost@gmail.com said:
Quote:
the only problem is how to print matric represented as array....
>>
>No, it isn't.
>
My Question is how to print a matric represented as array...
As you can see, the "regulars" here have no interest in answering your
question, but only want to use you as a pawn in their stupid games of
polemics and "topicality".

The problem in your code is here:
Quote:
for (i = 0; i < nn; i++) {
printf("\n");
for (j = 0; j < mm; j++) {
printf("A[%d,%d]=%d\t%d", i, j, A[i * nn + j], i * nn + j);
}
}
The (i,j)th entry of A should be A[i * mm + j], not A[i * nn + j].

Richard Heathfield
Guest
 
Posts: n/a
#18: Jul 4 '08

re: Bug in list of matrics represended as arays.....


Djuro.Tost@gmail.com said:
Quote:
>
>
Richard Heathfield je napisao/la:
Quote:
>Djuro.Tost@gmail.com said:
>>
><snip>
>>
Quote:
But the program works with Visual studio , the:#include "stdafx.h"
is needeed,
>>
>No, it isn't.
>>
Quote:
the only problem is how to print matric represented as array....
>>
>No, it isn't.
>>
I use a gcc where #include "stdafx.h"is not needeed,
but Visual Studio wants #include "stdafx.h"....
<OFF-TOPIC>
No, it doesn't have to be like that. Look, it's really easy. Follow these
instructions to set up a new project in Visual C++. The process looks
long-winded but, once you're used to it, it takes only a few seconds:

1) Start up Visual C++
2) Close any open projects
3) Menu selection: File/New...
4) If the Projects tab is not already selected, select it
5) Select the Win32 Console option in the list box on the left
6) On the right, type in a name for your project (e.g. Hello)
7) If you're not happy with the location, change it
8) Ensure that the Create New Workspace radio button is selected
9) Click OK
10) In the next dialog box, ensure that "An empty project" is selected
11) Click Finish
12) In the next dialog box, click OK
13) Menu selection: File/New...
14) If the Files tab is not already selected, select it
15) Click C++ Source File (we're using C, but bear with me)
16) Type in a name for the source file, ending in .c (e.g. hello.c)
17) Click OK. The dialog box closes, and an editor window opens, entitled
hello.c (or whatever you chose)
18) Menu selection: Project/Settings...
19) Click the C/C++ tab
20) Ensure that the General category is selected from the dropdown list
21) Change the warning level from 3 to 4
22) In the category dropdown, select "Customize"
23) Put a tick in the "Disable language extensions" checkbox
24) In the category dropdown, select "Precompiled headers"
25) Select the "Not using precompiled headers" radio button
26) Click OK.

And that's it. The dialog closes, and you can type your code into the
hello.c window, and compile it in the usual way.

ALL of this information is off-topic in comp.lang.c, which deals with the
language, not implementations of the language.

</OFF-TOPIC>
Quote:
My Question is how to print a matric represented as array...
If you have a pointer to the first element in an array of m*n ints and you
wish to display it in m rows of n, you can do it like this:

#include <stdio.h>

void display(int *p, int m, int n)
{
int i;
int j;
for(i = 0; i < m; i++)
{
for(j = 0; j < n; j++)
{
printf(" %d", *p++);
}
putchar('\n');
}
}

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
CBFalconer
Guest
 
Posts: n/a
#19: Jul 4 '08

re: Bug in list of matrics represended as arays.....


Djuro.Tost@gmail.com wrote:
Quote:
CBFalconer je napisao/la:
Quote:
>Keith Thompson wrote:
Quote:
>>CBFalconer <cbfalconer@yahoo.comwrites:
>>>
>... snip ...
Quote:
>>>
>>Agreed. (But it's likely that his implementation provides a
>><malloc.hheader, and using it, though not wise, isn't necessarily
>>an error.)
>>>
>>>Since in the first 7 lines, we find at least 4, probably 5, errors,
>>>it seems pointless to read further. Note that I have counted
>>>errors only once, even though the same error was repeated.
>>>
>>Most of the errors you counted weren't errors.
>>
>Since the point of my post was to impress the extent of his
>'errors' upon the newbie, why do people have to immediately degrade
>any such impression? And <malloc.h_is_ an error. It makes the
>source depend on things not prescribed by the C standard. All you
>are saying is that it may not get detected.
>
But the programm works compiled with Visual Studio 6.0,
and #include "stdafx.h" is needed...
The only problem is how to print a matric represented as array..
Visual Studio is not a C compiler, without making appropriate
provisions. This newsgroup discusses the C language, which is
portable to many hardware and software systems. Windows is a tiny
fraction of that environment. If you want Windows advice, go to a
Windows newsgroup.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

Nick Keighley
Guest
 
Posts: n/a
#20: Jul 4 '08

re: Bug in list of matrics represended as arays.....


On 3 Jul, 13:21, Djuro.T...@gmail.com wrote:
Quote:
The problem is how to print matrics....
other people have answered your question, this is just a few points
about
your code.
Quote:
* * * * prvi=(struct matrica*)malloc(sizeof(struct matrica));
the cast is unnecessary and may hide errors. Your code is easier
to read with more whitespace.

prvi = malloc (sizeof(struct matrica));
or
prvi = malloc (sizeof(*prvi));
or
prvi = malloc (sizeof *prvi);

you do not check if malloc() succeeded
Quote:
* * * * * * * * scanf("%d",&nn);
scanf() is error prone and difficult to use correctly. Better
is fgets() then sscanf() or fgets() and strtol(). You have not
checked scanf() has read anything (check the return value).
Quote:
* * * * * * * * printf("\nM=");
print() may not output the string until a newline is
encountered. Call fflush(stdout)
Quote:
* * * * * *if(c!='y') goto izlaz;
goto?! You can often structure your code to avoid this
Quote:
* * * * * * * * * *goto ulaz;
that's two gotos to two different labels. Alarm bells
are *really* ringing

<snip>

--
Nick Keighley

"Take guns and rockets and nukes, Sammy.
Lots and lots of nukes. "
Pham Nuwen (a deepness in the sky)
Joachim Schmitz
Guest
 
Posts: n/a
#21: Jul 4 '08

re: Bug in list of matrics represended as arays.....


Nick Keighley wrote:
Quote:
On 3 Jul, 13:21, Djuro.T...@gmail.com wrote:
>
Quote:
>The problem is how to print matrics....
>
other people have answered your question, this is just a few points
about
your code.
>
Quote:
>prvi=(struct matrica*)malloc(sizeof(struct matrica));
>
the cast is unnecessary and may hide errors.
The OP needs the cast as he's apparently compiling with the C++ part of
Visual C++, the filename lista_matrica.cpp hints that.

RH showed him how to correct that.

Bye, Jojo



Barry Schwarz
Guest
 
Posts: n/a
#22: Jul 4 '08

re: Bug in list of matrics represended as arays.....


On Thu, 3 Jul 2008 22:25:57 -0700 (PDT), Djuro.Tost@gmail.com wrote:

snip
Quote:
>
>But the programm works compiled with Visual Studio 6.0,
>and #include "stdafx.h" is needed...
stdafx.h is not needed. I replaced malloc.h with stdlib.h and removed
stdafx.h and Visual Studio 6.0 compiled the program just fine (with
warnings for the two unused variables and the non-standard //
comments).


Remove del for email
Joachim Schmitz
Guest
 
Posts: n/a
#23: Jul 4 '08

re: Bug in list of matrics represended as arays.....


Richard Heathfield wrote:
Quote:
<OFF-TOPIC>
No, it doesn't have to be like that. Look, it's really easy. Follow
these instructions to set up a new project in Visual C++. The process
looks long-winded but, once you're used to it, it takes only a few
seconds:
>
1) Start up Visual C++
2) Close any open projects
3) Menu selection: File/New...
4) If the Projects tab is not already selected, select it
5) Select the Win32 Console option in the list box on the left
6) On the right, type in a name for your project (e.g. Hello)
7) If you're not happy with the location, change it
8) Ensure that the Create New Workspace radio button is selected
9) Click OK
10) In the next dialog box, ensure that "An empty project" is selected
11) Click Finish
12) In the next dialog box, click OK
13) Menu selection: File/New...
14) If the Files tab is not already selected, select it
15) Click C++ Source File (we're using C, but bear with me)
16) Type in a name for the source file, ending in .c (e.g. hello.c)
17) Click OK. The dialog box closes, and an editor window opens,
entitled hello.c (or whatever you chose)
18) Menu selection: Project/Settings...
19) Click the C/C++ tab
20) Ensure that the General category is selected from the dropdown
list 21) Change the warning level from 3 to 4
22) In the category dropdown, select "Customize"
23) Put a tick in the "Disable language extensions" checkbox
24) In the category dropdown, select "Precompiled headers"
25) Select the "Not using precompiled headers" radio button
26) Click OK.
>
And that's it. The dialog closes, and you can type your code into the
hello.c window, and compile it in the usual way.
>
ALL of this information is off-topic in comp.lang.c, which deals with
the language, not implementations of the language.
>
</OFF-TOPIC>
Thanks for this anyway, it is slightly diffferent for Visual C++ Express
(and the German version) but it set me on the right track.

Bye, Jojo


pete
Guest
 
Posts: n/a
#24: Jul 4 '08

re: Bug in list of matrics represended as arays.....


Richard Heathfield wrote:
Quote:
Djuro.Tost@gmail.com said:
>
<snip>
>
Quote:
>But the program works with Visual studio , the:#include "stdafx.h"
>is needeed,
>
No, it isn't.
I had a colleague as a customer.
He was writing a program that had #include "stdafx.h" in it
but he didn't have enough time to finish the program himself.

I rewrote the whole thing as a portable C programm,
scrapping all the algorithms too.

When he started to tell me what his OS was,
I told him that I didn't want to know
and I delivered source code.

For further development, I had to use the MSDN library.

--
pete
Richard
Guest
 
Posts: n/a
#25: Jul 4 '08

re: Bug in list of matrics represended as arays.....


CBFalconer <cbfalconer@yahoo.comwrites:
Quote:
Djuro.Tost@gmail.com wrote:
Quote:
>CBFalconer je napisao/la:
Quote:
>>Keith Thompson wrote:
>>>CBFalconer <cbfalconer@yahoo.comwrites:
>>>>
>>... snip ...
>>>>
>>>Agreed. (But it's likely that his implementation provides a
>>><malloc.hheader, and using it, though not wise, isn't necessarily
>>>an error.)
>>>>
>>>>Since in the first 7 lines, we find at least 4, probably 5, errors,
>>>>it seems pointless to read further. Note that I have counted
>>>>errors only once, even though the same error was repeated.
>>>>
>>>Most of the errors you counted weren't errors.
>>>
>>Since the point of my post was to impress the extent of his
>>'errors' upon the newbie, why do people have to immediately degrade
>>any such impression? And <malloc.h_is_ an error. It makes the
>>source depend on things not prescribed by the C standard. All you
>>are saying is that it may not get detected.
>>
>But the programm works compiled with Visual Studio 6.0,
>and #include "stdafx.h" is needed...
>The only problem is how to print a matric represented as array..
>
Visual Studio is not a C compiler, without making appropriate
provisions. This newsgroup discusses the C language, which is
portable to many hardware and software systems. Windows is a tiny
fraction of that environment. If you want Windows advice, go to a
Windows newsgroup.
He wants C programming help. C syntax. C semantics. And this is a C
newsgroup. Why you have to make such a fool of yourself with every post
is anyones guess. Considering so many of the regs here solve bugs in
20,000,000 line code bases without even using a debugger, one would have
thought you and your mighty brain could have spotted the error in his *C
Code*.


Closed Thread