0

I'm currently running a shell project, I tried to compile the code using: `

gcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o hsh

The compilation method is mandatory for my project. The code compiles on ISO C99 (-std=gnu99), but returned the error: ISO C90 forbids variable length array when I used the above compilation method. How can I edit this code instead so it compiles on ISO C90?

This is the code I tried:

int i = 0, j = 0, k = 1;
int n = find_chars_number(s, sep, idx) + 1;
int array[n];
int o = 0;

array[0] = idx;

Error found on the line int array[n]; nb: find_chars_number is a function I invoked

John Bollinger
  • 160,171
  • 8
  • 81
  • 157
Jasper
  • 1

0 Answers0