Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing pointer of array on heap to a function

Status
Not open for further replies.

snow2003

IS-IT--Management
Dec 1, 2003
3
0
0
US
hey, I won't go into all the specifics of my situation, but could anyone give me the syntax for passing pointers that are on the heap? Does it (the syntax) differ because it's a pointer to an array?
 
here's a few snippets that might help:


void myFunc(float *a)
{
a[0] = 1;
a[1] = 2;
...
}


int main()
{

float *x;
x = (float *)malloc(100 * sizeof(float));

myFunc(x);

free(x);

return 0;
}
 
A C program required for portability

I have to solve a problem for my wife who is engaged in Research in Breast Cancer.

1. She has frequently to search a list of alphabetic characters for an exact match of a pattern.This pattern can be pasted into a file.Sometimes the characters are presented to her as a single line but other times as several columns which actually are intended to be a single line. Also the case can vary.

e.g. mwaaagglwrsraglralfrsrdaalfpgcerglhcsavscknwlkkfasktkkkvwyespslgshstykpskleflmrstskktrkedharlralngllykaltdllctpevsqelydlnvelskvsltpdfsacraywkttlsaeqnahmeavlqrsaahmslisywqsqtldpgmkettlykmisgtlmphnpaapqsrpqapvcvgsimrrstsrlwstkggkikgsgawcgrgrwls

OR

mwaaagglwrsraglralfrsrdaalfpgc
erglhcsavscknwlkkfasktkkkvwyes
pslgshstykpskleflmrstskktrkedh
arlralngllykaltdllctpevsqelydl
nvelskvsltpdfsacraywkttlsaeqna
hmeavlqrsaahmslisywqsqtldpgmke
ttlykmisgtlmphnpaapqsrpqapvcvg
simrrstsrlwstkggkikgsgawcgrgrwls

OR

MWAAAGGLWRSRAGLRALFRSRDAALFPGC
ERGLHCSAVSCKNWLKKFASKTKKKVWYES
PSLGSHSTYPKSKLEFLMRSTSKKTRKEDH
ARLRALNGLLYKALTDLLCTPEVSQELYDL
NVELSKVSLTPDFSACRAYWKTTLSAEQNA
HMEAVLQRSAAHMSLISYWQSQTLDPGMKE
TTLYKMISGTLMPHNPAAPQSRPQAPVCVG
SIMRRSTSRLWSTKGGKIKGSGAWCGRGRWLS

OR

MWAAAGGLWRSRAGLRALFRSRDAALFPGCERGLHCSAVSCKNWLKKFASKTKKKVWYEPSLGSHSTYPKSKLEFLMRSTSKKTRKEDHARLRALNGLLYKALTDLLCTPEVSQELYDLNVELSKVSLTPDFSACRAYWKTTLSAEQNAHMEAVLQRSAAHMSLISYWQSQTLDPGMKETTLYKMISGTLMPHNPAAPQSRPQAPVCVGSIMRRSTSRLWSTKGGKIKGSGAWCGRGRWLS

2. There are ONLY two patterns to be searched for -


r?r??s
r?r??t

The ? can be any of the following characters

acdefghiklmnpqrstvxy

3. Once an exact match/s has been made it is essential to know the number of characters from the start of the line to each match.It is possible that there is more than one match.

Can anyone suggest a program in ANSI C that will compile in the first instance in Solaris (SunOS 5.9).

But is portable (source and then re compile) to HP-UX and AIX and to XP.

It is urgent.

Thanks


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top