在C声明,声明和赋值语句之间的区别? [英] Difference between declaration statement and assignment statement in C?

查看:281
本文介绍了在C声明,声明和赋值语句之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来编程和努力学习C.我正在读一本书,我也读到了这些声明,但不明白自己的意思。

I am new to programming and trying to learn C. I am reading a book where I read about these statements but could not understand their meaning.

推荐答案

声明:

int a;

分配:

a = 3;

宣言和在一条语句中赋值:

Declaration and assignment in one statement:

int a = 3;

宣言说,我将使用名为变量 A 存储一个整数值。分配说,把值3到变量 A

Declaration says, "I'm going to use a variable named "a" to store an integer value." Assignment says, "Put the value 3 into the variable a."

(如@delnan指出的那样,我的最后一个例子是技术上的初始化的,因为你指定什么值的变量开头,而不是改变值。初始化特殊语法也支持指定结构或数组的内容。)

(As @delnan points out, my last example is technically initialization, since you're specifying what value the variable starts with, rather than changing the value. Initialization has special syntax that also supports specifying the contents of a struct or array.)

这篇关于在C声明,声明和赋值语句之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆