CoolInterview.com - World's Largest Collection of Interview Questions
 Interview Questions  
 Our Services  

Get 9,000 Interview Questions & Answers in an eBook.


  • 9500+ Pages
  • 9000 Question & Answers
  • All Tech. Categories
  • 14 MB Content

    Get it now !!


    Send your Resume to 6000 Companies


  • INTERVIEW QUESTIONS LANGUAGES C DETAILS
    Question :
    How to get string in files and print the string in the reverse order?

    Posted by: sivasankaran on 11/27/2007

    Contact sivasankaran  Contact sivasankaran
    Category C Interview Questions
    Rating (0.0) By 0 users
    Added on 11/27/2007
    Views 963
    Rate it!
    Answers:

    int main()
    {
    char str[] = "";
    FILE *fp,*fp1;
    int i=0;
    fp = fopen("a.txt","r");//Source file
    fp1 = fopen("b.txt","w");//Target file
    if (fp == NULL)
    {
    printf("
    Cannot open the file");
    return -1;
    }
    while( !feof(fp))
    {
    str[i] = fgetc(fp);
    if(str[i] == '
    ')
    {
    str[i+1]='



     Posted by: Syed Baseer Ahmed    

    Contact Syed Baseer Ahmed  Contact Syed Baseer Ahmed

    I think using push and pop you can do it.

    int i, j;
    char c[],y[];
    c[i]=get char();
    push;
    pop
    y[j]=put char();

    while (c[i] !=
    )
    begin
    if(c[i]=y[j])
    print(both strings are equal);
    else
    print ("both are not equal");
    end



     Posted by: ramarao    

    Contact ramarao  Contact ramarao

    #include <Stdio.h>
    void main()
    {
    chr *s ,*t;
    int i;
    fp=fopen("File Name "+b);
    fscanf(fp,"%s",s);
    *s=*t;
    while(*t!=NULL)
    {
    t++;
    i++;
    }

    while(i--)
    printf("%c",*t)

    printf("%c",*t);

    }



     Posted by: Jayakumar    

    Contact Jayakumar  Contact Jayakumar


    If you have the better answer, then send it to us. We will display your answer after the approval.
    Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification  Enter the above shown code:*
    Inform me about updated answers to this question

       
    Related Questions
    View Answer
    How I can add two numbers in c language without using Arithmetic operators?
    View Answer
    What is pointers and its uses?
    View Answer
    What is the difference between structure and union?
    View Answer
    What is pointer?
    View Answer
    Can we use functions within a structure?
    View Answer
    void main()
    {
    float a= 0.7;
    if (a < 0.7)
    printf("c");
    else
    printf("c++");
    }
    Output of the above program is c. Why? Whereas the same program with 0.8 instead of 0.7 gives c++ as the output? Why explain?
    View Answer
    Code for swapping of two numbers without using temporary variable using C.
    View Answer
    code To draw a three dimensional graph using c graphics
    View Answer
    How to write a C program for displaying a sentence without output command?
    View Answer
    What is difference between the test effort and the test procedure?
    View Answer

    Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

    Notify me when better answer is posted!
    Email:

    View ALL C Interview Questions

    User Options
    Sponsored Links


    Copyright ©2003-2009 CoolInterview.com, All Rights Reserved.
    Privacy Policy | Terms and Conditions
    Page URL: http://www.coolinterview.com/interview/12532/default.asp?cachecommand=bypass


    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Dedicated Servers | Joke of the Day

    0.72