+ 1
Why is the output an integer even i declared it as char
10 Antworten
+ 1
Ohh okay ~ swim ~ i didn't know that the array will be destroyed after the function call return..
I tried to make sense of malloc and all but didnt work out...im jst a beginner and will see to that..
0
~ swim ~ i didnt get you as a whole..yet ill try..
0
Ok ~ swim ~ now i have modified the code with my understanding..and why cant it work now..
Heres my explanation
The function returns wrd2 which is adress of the first letter of the charector arrar 'wrd2'..
So my char function returns an adress
So i modified:
char strtlwr()--> char *strlwr()
Since it returns an address it will be saved to the pointer function lyk:
Char *strlwr()=address
So wen we do:
Printf("%s",strlwr("HJJKJj"));
as you said her%s has an address to read and will print the array..
So where am i wrong here..? Thnks in advance
0
okay ~ swim ~ i have modified it...
is this what your talking about.,?
0
~ swim ~ and why should that be..we are assingning ptr with a value,,,and y shld it be a NULL?