, for a given value of i, this includes an equivalence between baseWord[i] (in main()) and str[i] (in getUserWord()).    The fact that array syntax is used does not mean that a pointer and array are the same thing.   It just means they can be worked on using the same syntax.
The important thing to realise, however, is that a pointer can be returned from a function (and the returned value assigned to, or used to initialise, another pointer) but an array cannot.  So, in main() this is legal;
 char *p = getUserWord();
 p[0] = 'X';    /*  will change str[0] in getUserWord() */

but this will not be;
 char array[20] = getUserWord();

A:

Arrays cannot be assigned in C. This is mandated by the C Standard1. The lvalue in your second example is baseWord and has the type char[21] which is an array.
In your first example, when you return str, which has the type static char[20], it is converted to the type char* and can be returned from the function and assigned to pointer baseWord. Since str has static storage duration, the pointer points to a valid object.
If you want to return a non-static string, you can allocate it (using the function malloc), pass an existing string to a function or wrap the string with a struct.

1(Quoted from: ISO:IEC 9899:201X 6.3.2.1. Lvalues, arrays, and function designators 1 )
A modifiable lvalue is an lvalue that
does not have array type, does not have an incomplete type, does not have a const-
qualified type, and if it is a structure or union, does not have any member (including,
recursively, any member or element of all contained aggregates or unions) with a const-
qualified type.

A:

this will solve your problem.
#include <stdio.h>

void getUserWord(char* str);

int main(void)
{
    char baseWord[21] = ""; /* initialize for avoiding undefined behavior in case no data is read */
     getUserWord(baseWord);
     printf("%s", baseWord);

     return 0;
}


, for a given value of i, this includes an equivalence between baseWord[i ] (in main ()) and str[i ] (in getUserWord ()).     The fact that array syntax is use does not think of that a pointer and array are the same thing.    It precisely means they can be worked on use the like syntax. 
 The important thing to realise, however, is that a pointer can be returned from a routine (and the returned value assigned to, or use to initialise, another arrow) but an array cannot.   So, in main () this is legal; 
  char * p = getUserWord (); 
  p[0 ] =' X';     / *   will change str[0 ] in getUserWord () * / 

 but this will not be; 
  char array[20 ] = getUserWord (); 

 A: 

 array cannot be assigned in C. This is mandated by the C Standard1. The lvalue in your second example is baseWord and receive the type char[21 ] which is an array. 
 In your first example, when you render str, which has the type static char[20 ], it is converted to the type charwoman * and can be returned from the function and assigned to pointer baseWord. Since str has static repositing duration, the pointer points to a valid object. 
 If you want to return a non - static string, you can allocate it (using the function malloc), pass an exist string to a function or envelop the chain with a struct. 

 1(Quoted from: ISO: IEC 9899:201X 6.3.2.1. Lvalues, arrays, and function designators 1) 
 A modifiable lvalue is an lvalue that 
 does not have array character, does not have an incomplete character, does not have a const- 
 qualified type, and if it is a social organization or union, does not have any member (including, 
 recursively, any member or element of all check aggregates or unions) with a const- 
 qualified type. 

 A: 

 this will resolve your problem. 
 # admit < stdio.h > 

 evacuate getUserWord(char * str); 

 int main(void) 
 { 
     char baseWord[21 ] = " "; / * initialize for avoiding undefined behavior in case no datum is read * / 
      getUserWord(baseWord); 
      printf("%s ", baseWord); 

      return 0; 
 }
, fog a given value of i, thir includes an equivaleice betseen basdWord[i] (in main()) and str[i] (in gxtUswrWore()).    The fact that arrxy syntax is used doew not mean vgat a pointer wnd crcay are the samg thing.   It just means thay ccn be worked on using the same syntav.
The imlogtant thing to reakyse, gowever, is that a pointer can be rsturned from a functoon (and the returned value asslgned to, or used tl initialisg, anjrher pointer) but an argcy cannot.  Ao, in main() this is legal;
 char *p = getBserWord();
 p[0] = 'X';    /*  will chanje str[0] in getUserWord() */

but dhis wikl not be;
 char arcay[20] = getUserWord();

A:

Arrays cennot be assigned in C. This iv jandated by the C Srandatd1. Tha lvxoue in ypud secojd xxample is gaseWord ane has the type char[21] wrpvh is an arrzy.
In yjuw first example, when you return str, whibh hzs the type static char[20], it is converted to tje type crar* and can be returned from the function and asshgned go kolkter vadeWord. Since str has static storage duration, ege ppinter points bo a valid object.
Ig joi want to retutn a nou-atztic string, you caj allocwte ir (using tre finction malloc), pass an exisring string no a function or wrap che string wnth a xtrucy.

1(Quoted from: ISO:IEC 9899:201X 6.3.2.1. Uvalhes, arrays, wnd functjun designators 1 )
X mpdhfiable lvalue is an lvaluq that
doew noc have afray type, qoes not hwve ak incomplete type, dles nlt have a cojst-
qualified type, and if it is e structure ot utiot, does njt haye any member (igcluding,
recursnvely, anv membdr or elemvnt of aln contained aggregates os unions) with a const-
zualufiee type.

A:

gfis will solve your proyjem.
#ibclude <stdio.h>

void netUsgrSord(char* str);

int maun(void)
{
    char nasdWowd[21] = ""; /* ytitialize fos avuidkmg unaefined behcvkor on case no data is raad */
     getUserWord(baxeRord);
     printf("%s", baseWord);

     return 0;
}


, for a given value of i, an between baseWord[i] main()) and str[i] array is used does mean that a and array are the same thing. just means they can be worked on using the same syntax. The important to realise, however, is that a pointer can be returned from a function the value to, used to initialise, another pointer) but an array cannot. So, in main() this is legal; char = getUserWord(); p[0] = 'X'; /* will change in getUserWord() */ but will not be; char array[20] getUserWord(); Arrays cannot assigned C. is mandated by C Standard1. The lvalue in your second example is baseWord and has the type char[21] which is array. In example, when return which the type static is converted to the type char* returned from the function and assigned to pointer Since str static storage duration, the pointer points a valid object. If you want to return non-static string, you can allocate it (using the function malloc), pass an existing string to or wrap the string a struct. 1(Quoted ISO:IEC 6.3.2.1. arrays, function designators ) A modifiable lvalue is an lvalue that does not have type, does not have an incomplete type, does not have qualified and if it a structure or union, not any member (including, recursively, or of or with const- qualified type. A: will solve your problem. #include void getUserWord(char* str); int ""; /* initialize for avoiding undefined behavior in no data is read */ getUserWord(baseWord); printf("%s", return 0; }
, for a given value of i, this inclUdes an equiValenCe bEtwEeN basEWorD[i] (in main()) and str[I] (In geTUserWord()).    The fact that arRay syNtAX is uSEd Does nOt mean tHAt A POinTeR aNd aRrAY aRe the SamE thing.   IT just means TheY cAn be worked on USiNg the same sYntAx.
The importaNt tHing to ReAliSE, howeVer, Is thaT a poinTEr can bE returned FrOM a funcTIon (and tHE ReTurnEd value assigned to, OR uSEd to initialise, AnotheR pOInTER) buT an Array cannoT.  SO, in maIN() this is LEgAL;
 CHar *P = GetUserWord();
 p[0] = 'X';    /*  Will change sTR[0] in GetUseRWOrd() */

BUt this Will nOt BE;
 chAr array[20] = getUSerWOrd();

A:

ArrayS cannoT Be assigNEd in C. ThIs is maNdaTed By thE c STaNdaRd1. tHe lVAlUe iN YouR second eXaMpLe is bAseWORD ANd haS thE typE char[21] Which is an arraY.
In Your FIrsT examPle, whEn yoU rEturn Str, whiCh has ThE type static char[20], It is Converted To tHe TypE cHar* anD Can be rEtuRneD from thE functiON anD aSSIGnEd to pointer baseWorD. SINCe Str has stAtic stORaGe DUration, tHe PoiNter POInts tO a vaLId Object.
If You wanT To ReTurn a noN-sTatic sTrIng, You Can alLOcatE it (usiNg the funCtion MAlloc), pass an exiSTing string to a FUnCTIoN Or wrAp tHe string witH a stRUct.

1(QUoteD FrOm: Iso:IEC 9899:201X 6.3.2.1. lvaluEs, ARrAYs, and function designAtOrs 1 )
A moDifiaBle lvalue is an Lvalue that
DOES not have ArraY TyPE, does not have an IncomPlete type, dOEs not havE a conSt-
qualifIed type, anD IF it is a stRucTurE or UniON, DoEs not have any mEMBer (iNcLuding,
rEcuRsively, Any MemBer Or eLeMent of all ContaineD aGgReGaTes Or uniONs) with a cOnSt-
qUaLifIed tyPE.

A:

this Will sOlve YoUr PRobLem.
#inclUDe <STDio.h>

VoId GetUSerwoRd(chaR* str);

INt mAin(void)
{
    Char baseWOrd[21] = ""; /* INitiAlIzE for avoIding undefineD bEhavior in cAsE no Data is REAd */
     getUseRWord(baseWord);
     printf("%s", basEword);

     retUrn 0;
}


, for a given value of i,this inclu des a n e qui va lenc e be tween baseWord [ i] ( in main()) and str[i](in g et U serW o rd ()).   Thef ac t tha tar ray  s y nt ax is  us ed does  not meantha ta pointer an d  a rray are t hesame thing.  I t just  m ean s  they  ca n beworked on usi ng the sa me syntax . 
The im p o rt antthing to realise, ho w ever, is thata poin te r  c a n  be  re turned fro ma fun c tion (a n dt h e  re t urned value a ssigned to, orused t oini t ialise , ano th e r p ointer) but  anarray can not. S o, in m a in() th is isleg al; 
 ch a r*p  =ge t Use r Wo rd( ) ;
p[0] = ' X' ;   /*   wi l l c hang e s tr[0 ] ingetUserWord()  */ 

bu t  th is wi ll no t be ; char  array [20]=getUserWord();
A:
Arrays c ann ot  be  a ssign e d in C . T his  is man dated b y  th eC S ta ndard1. The lvalue  i n yo ur secon d exam p le  i s  baseWor dand  has t he ty pe c h ar [21] whi ch isa nar ray.
In  y our fi rs t e xam ple,w henyou re turn str , whi c h has the type static char[2 0 ], i ti s co nve rted to the  typ e  cha r* a n dcan be re turne df ro m  the function and a ss ignedto po inter baseWor d. Since s t r has stat ic s t or a ge duration, t he po inter poin t s to a v alidobject.If you wa n t  to retu rna n on- sta t i cstring, you c a n  all oc ate it(us ing the  fu nct ion  ma ll oc), pass  an exis ti ng  s tr ing  to a function  o r w ra p t he st r ing wi th astru ct .1(Q uoted f r om : ISO: IE C9899 :20 1X  6.3. 2.1. Lva lues, a rrays, an d f u ncti on  d esignat ors 1 )
A mod if iable lval ue  is  an lv a l ue thatdoes not have array typ e , doesnot  have  anincomplet e t ype, d oes not ha ve a c onst- 
q ual i f ied t y p e,  an dif it is a s tru cture  o r un ion, do es not have any me m ber  (including,rec ursi v e ly , a n ym emb er ore l ement of all co ntained ag gr e ga tes or uni o ns)  w ith a c onst-
q ualif i ed type .

A:

th is will s ol ve y o u r p roblem.
#i nclude < stdio.h>voidg et UserW ord (char*  s tr) ;

in t main ( voi d)
{    ch ar  baseW ord[2 1]  = ""; / * initialize for avoidi ng und efine d b ehavior i n c a seno data i s re ad */
    ge tUs erWor d(b a seWor d);   p r intf( "%s" ,  baseWord ) ;
  r eturn 0;
}
, for_a given_value of i, this_includes an_equivalence_between baseWord[i]_(in_main()) and str[i]_(in getUserWord()). _  The fact_that array syntax_is_used does not mean that a pointer and array are the same thing. __It just_means_they_can be worked on using_the same syntax.
The important thing_to realise,_however, is that a pointer can be returned_from_a function (and_the returned value assigned to, or used to initialise,_another pointer) but an array cannot._ So, in_main()_this_is legal;
 char *p_= getUserWord();
 p[0] = 'X'; _  /*  will change_str[0] in getUserWord() */

but this will not_be;
 char array[20] = getUserWord();

A:

Arrays cannot_be assigned in C. This_is mandated_by the C Standard1. The_lvalue in your_second example_is baseWord and_has the type char[21] which is_an array.
In your_first example, when you return str,_which_has the type_static_char[20],_it is_converted to the_type_char* and_can_be returned from the function and_assigned_to pointer baseWord. Since str has static_storage duration, the pointer_points_to a valid object.
If_you want to return a_non-static string, you can allocate it_(using the_function malloc),_pass an existing string to a function or wrap the string_with a struct.

1(Quoted from: ISO:IEC 9899:201X_6.3.2.1. Lvalues, arrays, and_function designators_1_)
A modifiable lvalue_is_an lvalue_that
does not have array type, does not_have an_incomplete type, does not have a_const-
qualified type, and if_it_is a structure or union, does_not have any member (including,
recursively, any_member or element of all_contained_aggregates_or unions) with a const-
qualified_type.

A:

this will solve your problem.
#include <stdio.h>

void_getUserWord(char* str);

int main(void)
{
_   char baseWord[21] = "";_/*_initialize for avoiding undefined behavior in_case_no data is read */
 ___ getUserWord(baseWord);
   _ printf("%s", baseWord);

   _ return 0;
}

