strtok - это то, что вы ищете.
Пример:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* getTagValue(char* a_tag_list, char* a_tag)
{
/* 'strtok' modifies the string. */
char* tag_list_copy = malloc(strlen(a_tag_list) + 1);
char* result = 0;
char* s;
strcpy(tag_list_copy, a_tag_list);
s = strtok(tag_list_copy, "&");
while (s)
{
char* equals_sign = strchr(s, '=');
if (equals_sign)
{
*equals_sign = 0;
if (0 == strcmp(s, a_tag))
{
equals_sign++;
result = malloc(strlen(equals_sign) + 1);
strcpy(result, equals_sign);
}
}
s = strtok(0, "&");
}
free(tag_list_copy);
return result;
}
int main()
{
char a[]="name=RRR&school=AAA&roll=111&address=SSS";
char* name = getTagValue(a, "name");
char* school = getTagValue(a, "school");
char* roll = getTagValue(a, "roll");
char* address = getTagValue(a, "address");
char* bad = getTagValue(a, "bad");
if (name) printf("%s\n", name);
if (school) printf("%s\n", school);
if (roll) printf("%s\n", roll);
if (address) printf("%s\n", address);
if (bad) printf("%s\n", bad);
free(name);
free(school);
free(roll);
free(address);
free(bad);
return 0;
}