C언어로 helloworld만 해본 나에게 너무 어렵네요.


일딴
덧셈만 좀 해볼려고 하는데

오류 뜨고 안됨.
배열에 저장만이라도 되면 좋을 텐데

좀 도와 주세용 ㅠㅠ


#include <stdio.h>
#include <string.h>

int main ()
{

 int x=0, y=0;
 char str[1024];
    char *pch;
 char *token[256];

 printf(">> mycalc ");
 gets(str);

 int sum, i=0;
 int pos;
 char *poss;

    printf ("Splitting string \"%s\" into tokens:\n",str);
    pch = strtok (str," + ");
    while (pch != NULL)
    {
  pos=i;
        printf ("%s\n",pch);
        pch = strtok (NULL, "+-* ");
  token[i]=pch;
  i++;
 }
 
 for(i=0; i<=pos; i++)
  sum+=token[i];


  printf("%d\n",sum);

 

    return 0;
}