Thread: Subscripted value is neither array nor pointer nor vector. Hangman Program.

  1. #1
    Registered User
    Join Date
    Feb 2020
    Posts
    7

    Subscripted value is neither array nor pointer nor vector. Hangman Program.

    I really can't see how I can fix these errors in my program. It would be really great if someone could help me, thank you
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Aug 2019
    Location
    inside a singularity
    Posts
    308
    Even we really can't see how we can fix these errors in your program. More specifically, we don't see any errors in your program because you didn't even put the slightest bit of effort into posting your errors.
    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook, The Wizardry Compiled

  3. #3
    Registered User
    Join Date
    Aug 2019
    Location
    inside a singularity
    Posts
    308
    Well, these are your errors. Stupid ones.

    Code:
    ||=== Build: Debug in Template (compiler: GNU GCC Compiler) ===|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp||In function 'int main()':|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|58|error: 'time' was not declared in this scope; did you mean 'time_t'?|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|80|warning: left operand of comma operator has no effect [-Wunused-value]|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|80|warning: right operand of comma operator has no effect [-Wunused-value]|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|80|warning: right operand of comma operator has no effect [-Wunused-value]|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|80|warning: right operand of comma operator has no effect [-Wunused-value]|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|80|warning: right operand of comma operator has no effect [-Wunused-value]|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|80|warning: right operand of comma operator has no effect [-Wunused-value]|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|80|warning: right operand of comma operator has no effect [-Wunused-value]|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|80|warning: right operand of comma operator has no effect [-Wunused-value]|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|80|warning: right operand of comma operator has no effect [-Wunused-value]|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|80|warning: right operand of comma operator has no effect [-Wunused-value]|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|80|error: array must be initialized with a brace-enclosed initializer|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|86|error: 'worldlength' was not declared in this scope; did you mean 'wordlength'?|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|90|error: invalid types 'char[int]' for array subscript|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|104|warning: format '%c' expects argument of type 'int', but argument 2 has type 'int*' [-Wformat=]|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|104|warning: format '%c' expects argument of type 'int', but argument 2 has type 'int*' [-Wformat=]|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|118|error: break statement not within loop or switch|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|124|error: expected '}' at end of input|
    C:\Users\aryan\Desktop\Projects\Template\main.cpp|57|note: to match this '{'|
    ||=== Build failed: 6 error(s), 13 warning(s) (0 minute(s), 2 second(s)) ===|
    Code:
    srand(time(NULL)); // You forgot including the header file time.h
    
    int guessedletter[11]=(0,0,0,0,0,0,0,0,0,0,0); // learn how to initialise arrays
    
    for (loopIndex=0; loopIndex<worldlength;loopIndex++) // yes, worldlength is the correct spelling of wordlength
    
    // Learn to indent your code
    
    // characters are not arrays to be subscripted
    
    // read about printf and format specifiers before using it
    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook, The Wizardry Compiled

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Subscripted value is neither array nor pointer nor vector
    By IsobelMunden in forum C Programming
    Replies: 3
    Last Post: 04-29-2020, 04:39 AM
  2. Replies: 119
    Last Post: 05-26-2019, 12:40 AM
  3. Subscripted value is neither array nor pointer ?
    By prietito1 in forum C Programming
    Replies: 2
    Last Post: 08-08-2012, 12:42 AM
  4. Replies: 1
    Last Post: 05-08-2010, 10:03 PM
  5. subscripted value is neither array nor pointer
    By new_to_c in forum C Programming
    Replies: 8
    Last Post: 04-01-2007, 02:43 PM

Tags for this Thread