The purpose of the code is to return array of strings variable to main
I am giving input 3 strings in function call()
these strings are stored in a variable "str"
then that is returned to main, I want to print them in main..
if i give input as
---------------------------
aaa
bbb
ccc
------------------------------
output is
------------------------
aaa
garbage value
garbage value
---------------------------------
    I want to know why garbage values are being printed..............
----------------------------------here is the code ----------------------
#include<stdio.h>

char* call()
{
        int k=3,h=0;
        char *str[3];
        for(h=0;h<k;h++)
        {
                    printf("Enter the String");
                scanf("%s",str+h);
         }
        return *str;
}
int main()
{
        int i=3,j=0;
        char name[i][20];
        name[0]=call();

        for(j=0;j<i;j++)
        {
                     printf("The string %d",j);
                printf("%s\n",name+j);
        }

        return 0;
}



                                
---------------------------------
 Here’s a new way to find what you're looking for - Yahoo! Answers 

[Non-text portions of this message have been removed]

Reply via email to