0

Ok I am in the process of making a simple hangman game. I need help pulling a string which is in an array dict[num] num being a random number. I just need a way to get that string out and use strlen() and such functions to work with it.

As of now strlen(dict[num]) does not work?

Tony The Lion
  • 59,704
  • 62
  • 233
  • 403
Zack Tarr
  • 841
  • 1
  • 8
  • 25

1 Answers1

1

if the type of the dict array is char then to get the length

strlen(dict)

and not

strlen(dict[num])

and if the

strlen(dict)

gives segmentation error then chek that your array is filled with string I mean check the string in the array end with the null character '\0'

MOHAMED
  • 38,769
  • 51
  • 148
  • 252