0

Having trouble with strings..(C)

So, user types in a string and I store it in an array.. Ex. char arr[20]; // input : "tuna" I check for the end of string using eof... can't find the end. Used the '\0' pointer still doesn't work since I already allocated memory for the string. How do I get the result -> length = 4?

29th Jul 2018, 5:07 PM
Akib
Akib - avatar
5 Answers
30th Jul 2018, 3:36 AM
Meet Mehta
Meet Mehta - avatar
30th Jul 2018, 4:05 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
Oh.. i wrote it wrong here. I removed that part of the code. Wish I could see if that was the case. Thanks Ketan Lalcheta .
30th Jul 2018, 9:20 AM
Akib
Akib - avatar
0
MEET MEHTA thanks a lot. Forgot about that function. Ketan Lalcheta I tried that way at first but for some reason it didn't work.
30th Jul 2018, 4:39 AM
Akib
Akib - avatar
0
Akib Reza might be u were using '/0' in place of '\0'
30th Jul 2018, 9:03 AM
Ketan Lalcheta
Ketan Lalcheta - avatar