S
somenath
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
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