strchr

Joined
Nov 15, 2008
Messages
5
Reaction score
0
Hi Im having troubles with this function. Help would be greatly appreciated as im not very good with this stuff.

Heres what I have to do: The function must find the first character in the chain pointed by glaPtr that is not in the chain pointed by alreadyseenPtr. It must return this character. If all characters in the first chain are in the second chain, the function must return '\0'.

Ex1:
alreadyseenPtr AG
glaPtr AGS
Function must return S

Heres what I have so far and I dont think its doing its job good as my program isnt working:

char function3(char *glaPtr, char *alreadyseenPtr)
{
char next;

int flag;
next = '\0';
flag = 1;


while (next = '\0' && flag == 1)
{
next = *strchr(dejaVuPtr, *synthesePtr);
if (next != NULL)
{
next = *synthesePtr;
flag = 0;
}
else
{
glaPtr++;
}
}


return (next);
}
 
Last edited:
Joined
Nov 15, 2008
Messages
5
Reaction score
0
sry for bumping but im really really really desperate. Assigment is due tomorrow morning and still cant figure it out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top