Printing pointer addresses in C [two questions]

前端 未结 5 767
感动是毒
感动是毒 2021-01-04 14:02

I know that my questions are very simple but googleing them didn\'t get me any useful results... They\'r probably too simple!!

No. 1

char* createStr(         


        
5条回答
  •  悲哀的现实
    2021-01-04 14:31

    The first example allocates the string, then returns a pointer to it. When you do the assignment from the method's return value, you just assign the pointer. You only ever made one string.

    In the second example, you want atoi.

提交回复
热议问题