U
U
underprogrammer2019-04-28 01:33:15
Pascal
underprogrammer, 2019-04-28 01:33:15

Info is not declared on the type. What is the problem?

info is not declared in type ^TElem
below error

type
  TInfo = char;
  PElem = ^TElem;
  TElem = record
      info: TInfo;
      next: PElem;
  end;


procedure SearchIt;
var
ListC: PElem;
numD, numE, num: integer;
begin
numD := -1;
numE := -1;
num := 1;
ListC :=NachaloSpiska;
while ListC<>nil do
begin
  if (ListC.info = 'Д') and (numD = -1) then     <----------- НА ЭТОЙ СТРОКЕ ОШИБКА
    numD := num;
  if (ListC.info = 'Ё') and (numE = -1) then
    numE := num;
  num := num + 1;
  ListC:=ListC^.next;
end;
if (numD <> -1) then
  writeln('Первый символ Д встречается на позиции ', numD)
else
  if (numE <> -1) then
  begin
    writeln('Символ Д отсутствует в списке');
    writeln('Первый символ Ё встречается на позиции ', numE);
  end
  else
    writeln('Символы Д и Ё отсутствуют в списке')
end;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Mirilaczvili, 2019-04-28
@temirlan_official

You must first dereference the variable at the address of ListC. Instead ListC.infoof like this:
ListC^.info

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question