The code:
allocates space for n**2 pointers to integers.
The code:
Tries to store N**2 integers (not pointers to integers) into a doubly dimensioned array, but the compiler has never been told the dimensions of that array. So, that can't work.
It looks like your code might be trying to set up an array of N pointers with each pointer pointing to a vector of N integers. But without seeing the code that defines check_property(), I'm obviously just guessing. Assuming that the 1st argument to that function is supposed to be a pointer to an array of N integers (not an array of pointers to integers), the following modification of your program might give you something you can use as a starting point:
Obviously you need to replace the check() function in this code with your own check() function. And, obviously, you need to have something that pipes or redirects a file that contains N**2 strings representing integer values into this code. If you just invoke it as:
your program will hang until you type in 256 integer values separated by whitespace characters and with at least the last integer value followed by a <newline>.
Note also that instead of using vec as a doubly dimensioned array when reading values into it and printing the value stored in it, it treats it as a singly dimensioned array and gives the function s() the dimensions of the array and the row and column values to get the offset in that array treated as though it were a doubly dimensioned array.
If you invoke it with:
it will produce the output:
These 3 Users Gave Thanks to Don Cragun For This Post:
I have written a program which takes a directory as command line arguments and displays all the dir and files in it.
I don't know why I have a problem with the /etc directory.It displays all the directories and files untill it reaches a sub directory called peers which is in /etc/ppp/peers.the... (4 Replies)
Hi ,
During execution a backup binary i get following error
"Program error 11 (Segmentation fault), saving core file in '/usr/datatools"
Riyaz (2 Replies)
What's the difference between Segmentation fault and Bus error and Illegal instruction?
Sometimes I got the one, and sometimes i got another, what are their differences?
Segmentation fault (core dump)?
Bus error (core dump)?
Illegal instruction (core dump)
Thanks
Daniel (2 Replies)
hi all
is there any way to capture the segmentation fault error when i run sqsh on a unix shell script.
Ex:
#!/bin/ksh
sqsh -S "server" -U "user" -P "pwd" << EOF
use mydb
go
exec proc1
go
exit
EOF
retval=$?
echo "sqsh return value $retval"
if
then
exit (1 Reply)
Hi,
I am having this segmentation fault not in the following program, bt. in my lab program . My lab program is horrible long so cannot post it here bt. I am using the following logic in my program which is giving the segmentation fault. Bt. if I run this sample program as it is it dosen't give... (3 Replies)
Hi all,
I have a folder with some 28 files. I have a script file that will iteratively take one file at a time from the folder and provide an output for the input file. Till the 7th file, there was no problem but from the 8th file onwards, i got this Segmentation Fault(Core Dump) error. A file... (2 Replies)
This code is causing a segmentation fault and I can't figure out why. I'm new to UNIX and I need to learn how to avoid this segmentation fault thing. Thank you so much. Thanks also for the great answers to my last post.:):b:
int main()
{
mysqlpp::Connection conn(false);
if... (3 Replies)
I use a binary name (ie polo) it gets some parameter , so for debugging normally i do this :
i wrote script for watchdog my app (polo) and check every second if it's not running then start it , the problem is , if my app , remain in state of segmentation fault for a while (ie 15 ... (6 Replies)
Oddities with gcc, 2.95.3 for the AMIGA and 4.2.1 for MY current OSX 10.14.1...
I am creating a basic calculator for the AMIGA ADE *NIX emulator in C as it does not have one.
Below are two very condensed snippets of which I have added the results inside the each code section.
IMPORTANT!... (11 Replies)