what does the function returns with in C program , in case if there is no return statement in the code

后端 未结 3 1241
情书的邮戳
情书的邮戳 2021-01-24 04:40

I made a function on how to reverse a singly linked list recursively in C.

the function is as below.

struct node * reverseSLL2(struct node *p,struct node         


        
3条回答
  •  死守一世寂寞
    2021-01-24 04:45

    When a non-void function returns without a return statement, it is Undefined Behaviour (UB). Make sure to avoid this.

    However, the function still might return something even without using the return statement. For example, on x86 architectures, the function will return whatever is there in the eax register, which will most probably be one of the local variables.

提交回复
热议问题