I have to write a program that finds a pattern in a text using Brute-force method.
I have made functions to read the text file, pattern file and to execute the brute force algorithm(called match). These are called in main(). i need to store the index (at which the pattern is found in the text file)in an array and then print out that array in main.
How do I pass the array by reference??? Please help!!
the program gives an error that you cannot pass an array by reference.
Also, whenever I declare an array (in the function, match()) like this:
int arr[text_file_size]; (text_file_size is the size of the text file obtained by fseek() and ftell())
the program gives an error that you cannot initialize a constant array of size 0.
I printed out the text_file_size,it was not zero.
Please help.
Remy the cook 0 Newbie Poster
firdousahmad -1 Junior Poster in Training
Lucaci Andrew 140 Za s|n
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
Lucaci Andrew 140 Za s|n
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
Lucaci Andrew 140 Za s|n
firdousahmad -1 Junior Poster in Training
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
Remy the cook 0 Newbie Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
Remy the cook 0 Newbie Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
Remy the cook 0 Newbie Poster
Lucaci Andrew 140 Za s|n
Remy the cook 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.