#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#pragma warning(disable:4996)
int main()
{
char n+;
scanf_s("%s", n,10);
char x[] = " X";
char *token;
int sum = 0;
int sum1 = 0;
token = strtok(n, x);
int size = strlen(token);
int t = size;
sum = (t*(t + 1)) / 2;
sum1 = sum1 + sum;
while (token != NULL)
{
token = strtok(NULL, n);
size = strlen(token); .!! 0x7BD6F6E0(ucrtbased.dll)에(ConsoleApplication9.exe의) 처리되지 않은 예외가 있습니다. 0xC0000005:0x00000000 위치를 읽는 동안 액세스 위반이 발생했습니다..
int t = size;
sum=(t*(t + 1))/ 2;
sum1 = sum1 + sum;
}
printf("%d", sum1);
}
대충 보면 입력길이 초과해서 그런거 아님?
반복문 안에서만 오류남..
NULL
null문제임