• 12-07-2002
condorx
i have a polynomial function p(x)=3x^2+2x-2
how can i get the constant values and exponents for instance
i think i have to get this polynomial function as a string isthis a good way??
• 12-07-2002
kuphryn
Do you want to extract numbers from a string?

Kuphryn
• 12-07-2002
Pioneer
Easy.
Code:

```#include <stdio.h> #include <stdlib.h> typedef struct list{int constant, exponent; struct list *next;}LIST; main(){     int c, e;     LIST *head = malloc(sizeof(LIST)), *walk = head;     while (scanf("(%d,%d),", &c, &e) == 2){         walk->next = malloc(sizeof(LIST));         walk = walk->next;         walk->constant = c;         walk->exponent = e;         walk->next = 0;     }     for (walk = head->next; walk; walk = walk->next)         printf("(%d,%d)\n", walk->constant, walk->exponent ); }```
Input:
(3,2),(2,0),(-2,0)

Output:
(3,2)
(2,0)
(-2,0)
• 12-07-2002
condorx
simply i want to take the constant values and exponent of x to another integer matrix[5][2]
for instance
p(x)=3x^2+2x

array take all the the integers array[1][0]=3 array[1][1]=2 and so on..
• 12-07-2002
Pioneer
First you want a linked list now you want an array? I think you should make up your mind about how to do it before you start doing it.
• 12-07-2002
condorx
no i used array to illustrate what i want?i thought it is easier