Re: Staic array de allocation
- From: Richard <rgrdev@xxxxxxxxx>
- Date: Tue, 31 Jul 2007 10:55:35 +0200
somenath <somenathpal@xxxxxxxxx> writes:
Hi ALL,
I have a doubt regarding declaration of static variable.
Suppose if we declare a char array as static then when the memory
reserved for the elements of the array will be de allocated .For
example when the memory reserved for "array[10]" will be de
allocated ?
#include<stdio.h>
char *return_static();
int main(void)
{
char *received = NULL;
received = return_static();
printf("\n Contain of array = %s\n",received);
return 0;
}
char *return_static()
{
static char array[10]={"hello"};
return array;
}
Regards,
Somenath
What does your reference book say about static? Why would you question
this? The array stays valid until the program exist.
.
- Follow-Ups:
- Re: Staic array de allocation
- From: Richard
- Re: Staic array de allocation
- References:
- Staic array de allocation
- From: somenath
- Staic array de allocation
- Prev by Date: Re: Calling a function with a literal list of strings?
- Next by Date: Re: circular shift array
- Previous by thread: Re: Staic array de allocation
- Next by thread: Re: Staic array de allocation
- Index(es):
Relevant Pages
|