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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:56:30+00:00 2026-05-27T08:56:30+00:00

If this is possible: #include <stdio.h> #include <process.h> #define SIZE 5 void PassingArray(int arr[])

  • 0

If this is possible:

#include <stdio.h>
#include <process.h>

#define SIZE 5

void PassingArray(int arr[])
{
    int i=0;
    for(i=0 ; i<SIZE ; i++)
    {
        printf("%d, ", arr[i]);
    }
    printf("\n");
}

main()
{
    int myIntArray[5] = {1, 2, 3, 4, 5};

    PassingArray(myIntArray);

    system("PAUSE");
}

Then why the following is illegal?

#include <stdio.h>
#include <process.h>

#define SIZE 5

int ReturningArray()[]
{
    int myIntArray[5] = {1, 2, 3, 4, 5};

    return myIntArray;
}

main()
{
    int myArray[] = ReturningArray();

    system("PAUSE");
}
  • 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-27T08:56:31+00:00Added an answer on May 27, 2026 at 8:56 am

    There’s multiple reasons why this doesn’t work.

    The first is simply that it’s prohibited by the language – the return type of a function shall not be an array (it also can’t be a function).

    The second is that even if you were allowed to declare ReturningArray as you do, you could never write a valid return statement in that function – an expression with array type that is not the subject of the unary & or sizeof operators evaluates to a pointer to the first element of the array, which no longer has array type. So you can’t actually make return see an array.

    Thirdly, even if we somehow had a function returning an array type, you couldn’t use that return value as the initialiser of an array variable – the return value would again evaluate to a pointer to the first element of the array: in this case a pointer to int, and a pointer to int isn’t a suitable initialiser for an array of int.

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

Sidebar

Related Questions

Possible Duplicate: Is this undefined C behaviour? #include<stdio.h> int main() { int a=5; printf(%d
Is something like this possible in C? #include <stdio.h> void print_str(char *str) { printf(str);
Say you have a C code like this: #include <stdio.h> int main(){ printf("Hello, world!\n");
Consider this little program: #include <stdio.h> int main() { char c = 0xFF; printf(%d\n,
Check out this code #include<stdio.h> int main() { const int a=7; int *p=&a; (*p)++;
This little piece of code is making me crazy: #include <stdio.h> int main() {
Possible Duplicate: strange output in comparision of float with float literal #include<stdio.h> int main()
#include<stdio.h> #include<conio.h> #include<alloc.h> struct node { int data; struct node*link; }; void push(struct node*,int);
Currently I have this code, and it works. #include <stdio.h> int isFactor(long number1, long
Is something like this possible in C++ (on Arduino)? #include stdio.h String str =

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.