---
title: "赋值语句的返回值"
author: "vergilwang"
date: "2013-03-21T17:57:00Z"
tags: []
categories: ["编程语言"]
slug: "untitled"
draft: false
lastmod: "2014-02-15T15:38:55Z"
id: 2011269
url: "https://vergilwang.iteye.com/blog/2011269"
---

#include &lt;iostream&gt;  
using namespace std;  
int main()  
{  
char A\[4] = {'a', 'b', 'c', '\\0'};  
char B\[4] = {'A', 'B', 'D', '\\0'};  
char* a = A;  
char* b = B;  
while(1)  
{  
if((\*b++ = \*a++) == '\\0')  
{  
break;  
}  
}

}

 

**The value of (\*b = \*a) is from the assigned value, e.g. (\*b)**

**Let' s the answer by GDB.**

28if((\*b++ = \*a++) == '\\0')  
2: B = "aBD"  
1: A = "abc"  
(gdb) p (\*b = \*a)  
$2 = 98 'b'  
(gdb) n  
26while(1)  
2: B = "abD"  
1: A = "abc"  
(gdb) p (\*b = \*a)  
$3 = 99 'c'  
(gdb) p &(\*b = \*a)  
$4 = 0xbffff2ea "c"  
(gdb) p b  
$5 = 0xbffff2ea "c"  
(gdb) p a  
$6 = 0xbffff2ee "c"