Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is the default initial value of a variable in C language?

Shulou Source: shulou.com Published: 2022-06-02 08:12:22 09月27日 Update

What this article shares to you is about the default initial value of variables in C language. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it with the editor.

# include

Int a1, a2

Float b1, b2

Char c1, c2

Int main (void)

{

Int a3, a4

Float b3, b4

Char c3, c4

Printf ("Global variables: A1 =% d, a2 =% d, b1 =% f, b2 =% f, C1 =% d, c2 =% d\ n", A1, a2, b1, b2, C1, c2)

Printf ("Local variables: A3 =% d, A4 =% d, b3 =% f, b4 =% f, c3 =% d, c4 =% d\ n", A3, A4, b3, b4, c3, c4)

Return 0

}

The running result of the program is:

Global variables: A1 = 0, a2 = 0, b1 = 0.000000, b2 = 0.000000, C1 = 0, c2 = 0 local variables: A3 = 4200660, A4 = 4200754, b3 = 0.000000, b4 = 0.000000, c3 = 0, c4 = 0 is what is the default initial value of variables in C language. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Variables initial values languages global local more knowledge articles practical that is work meetings articles look knowledge points procedures results industry details information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Shulou Technology Huawei NVidia Xiaomi