Hi! For my first question, how do I empty a string? I want to remove all its elements since I will be reusing the string. We're required to create a program that will make the user input a string and then it should have the option of deleting the contents of the string.
For my second problem, let's say that I have a text file named trial.txt with this written:
john
15
sam
17
joe
19
I want to print just the numbers below the names. In my program, I'm currently looping this:
It's supposed to print the ages one by one but all it prints are zeroes. How do I fix this?Code:fscanf(fp,"\n%d\n\n",age); printf("%d\n",age);



LinkBack URL
About LinkBacks


