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 8350247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:15:27+00:00 2026-06-09T08:15:27+00:00

I try to make a test code to get the pointer return value: #include

  • 0

I try to make a test code to get the pointer return value:

#include <stdio.h>

int main(void){

  char myStrcpy(char *str1,char *str2){
    while(*str2 != '\0'){
      *str1++ = *str2++;
    }
    *str1 = '\0';
    return str1;// return the final pointer that should point to the '\0'
  }

  char *reValue;
  char string1[] = "abcd";
  char string2[10];
  reValue = myStrcpy(string2,string1);
  reValue--;//now it should point to the last character which is `d`
  printf("this value of string 2 is %s\n",string2);
  printf("the return value the function is %c\n",*reValue);
  return 0;
}

gcc compiles this code with no error and warning, but clang gives me 4 errors:

my_stcpy.c:4:40: error: expected ';' at end of declaration
        char*  myStrcpy(char *str1,char *str2){
                                              ^
                                              ;
my_stcpy.c:14:2: error: use of undeclared identifier 'reValue'
        reValue = myStrcpy(string2,string1);
        ^
my_stcpy.c:15:2: error: use of undeclared identifier 'reValue'
        reValue--;
        ^
my_stcpy.c:17:50: error: use of undeclared identifier 'reValue'
        printf("the return value the function is %c\n",*reValue);
                                                        ^
4 errors generated.

any idea?

  • 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-06-09T08:15:30+00:00Added an answer on June 9, 2026 at 8:15 am

    GCC supports nested functions and clang does not (and isn’t in a hurry to do so).

    It looks like your function is nested by accident; just move it outside of the main function and it’ll keep working.

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

Sidebar

Related Questions

I try to make a apps that need barcode scanner, i already can get
I have a struct struct request { int code; char *message; }; that I'd
I try to make some maven plugin. I need to get path for artifact
I try to make a refund transaction via my django app using code: class
I try to run MATLAB code in Java with MATLAB Builder JA to get
When I try the code below in Cassini, I get a valid response. When
I am using the following code to try to make a RunOnce entry: program
I use some code from the PHP manual to make an exception test, but
I try to make my ListBox connected to ObservaleCollection be more efficient so for
I try to make an ActiveX by C# with COM-visible. It is a Windows

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.