fgetc

Returning a string [char pointer] from a function [duplicate]

Returning a string [char pointer] from a function [duplicate]
This question already has an answer here:Return char[]/string from a function3 answersI am writing a program that returns a string from stdin, but i am getting warning that it returns an adress of local wariable. How can i return the string?thanks in

Weird end values when reading from file using fgetc()

Weird end values when reading from file using fgetc()
I'm usingfgetc()to read a char from a file which consists of digits only. Then I convert the characters to int and print it out. That's fine. But after printing out all the digits, at the end I get-38-49values. I googled it, but nothing about it ther

fgetc,getc causes the program to crash when reading from text file [closed]

fgetc,getc causes the program to crash when reading from text file [closed]
Whats wrong? I'm pretty sure my syntax is correct since it has no warnings. Plus it won't go pastgetc(document);I triedfgetc(document);same result. What am I not getting here? (I usedprintf("$");to see where it crashes)char temp[51]; int cntr =