main()
{
FILE *fs;
char c[10];
fs = fopen(“source.txt”, ”r”); /* source.txt exists and
contains “Vector Institute” */
fseek(fs,0,SEEK_END);
fseek(fs,-3L,SEEK_CUR);
fgets(c,5,fs);
puts(c);
}



main() { FILE *fs; char c[10]; fs = fopen(“source.txt”, ”r”); /* source.txt exists and ..

Answer / sahoo845

it prints ute.
SEEK_END moves the pointer to end of the file.
SEEK_CUR moves the pointer 3 places back(-3L). Nw the pointer is at u.
gets() tries to fetch 5 characters from the present position of pointer but can fetch only 3 characters as it reaches end of file.
puts() prints the characters i.e. ute.

Is This Answer Correct ?    15 Yes 0 No

Post New Answer

More C Interview Questions

Tell me with an example the self-referential structure?

0 Answers  


Is c is a procedural language?

0 Answers  


What are type modifiers in c?

0 Answers  


Can we declare function inside main?

0 Answers  


What are different types of variables in c?

0 Answers  






HOW CAN ADD OUR FUNCTION IN LIBRARY.

5 Answers  


yogesh patil in dell

3 Answers   DELL,


what is the difference between #include<stdio.h> and #include"stdio.h" ?

6 Answers   TCS,


what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values

0 Answers   College School Exams Tests,


Taking an example,differentiate b/w loader and linker ?

1 Answers  


int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;

0 Answers  


write a program without using main function?

2 Answers   TCS,


Categories