Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6920753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:11:18+00:00 2026-05-27T10:11:18+00:00

void main() { void strrev(char *); char *p=GOOd; strrev(p); printf(%s,p); } void strrev(char *str)

  • 0
void main() { 
    void strrev(char *); 
    char *p="GOOd";
    strrev(p);
    printf("%s",p);
}

void strrev(char *str) { 
    char temp, *end_ptr;
    if( str == NULL || !(*str) ) return;
    end_ptr = str + strlen(str) - 1;

    while( end_ptr > str ) 
    { 
        temp = *str; 
        *str = *end_ptr; 
        *end_ptr = temp; str++; 
        end_ptr--; 
    } 
}

i am getting the error segmentation failed can any one help me out how to sort it out…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:11:19+00:00Added an answer on May 27, 2026 at 10:11 am

    One problem is that in the following:

    char *p = "GOOd";
    

    the compiler is allowed to place the string literal in read-only memory.

    Any attempt to modify the string pointed to by p results in undefined behaviour.

    Try changing the above line to:

    char p[] = "GOOd";
    

    I don’t see anything wrong with the strrev() function itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

static void Main() { string str; str = Console.ReadLine(); while (str != null)//HERE! {
void main() { char str[2][7] = {1234567, abcdefg}; char** p = str; printf(%d\n, *(p+1));
void main(){ int i,k; char* p; int j; printf(address of i is %d \naddress
void main() { char s[]=\12345s\n; printf(%d,sizeof(s)); } When i compile it it giving 6.
void main() { typedef boost::ptr_map<int, char> MyMap; //typedef std::map<int, char *> MyMap; // in
void main() { randomize(); char city[][10]={DEL,CHN,KOL,BOM,BNG}; int i,fly; for(i=0;i<3;i++) { fly=random(2)+1; cout<<city[fly]<<:; } }
void main() { const int * a; *a = 5; } gcc error :
void main() { float a = 0.7; if (a < 0.7) printf(c); else printf(c++);
void main() { if(a == a) printf(Yes, equal); else printf(No, not equal); } Why
So basically: #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> int main(void){ //test strrev

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.