[metadata]
id = "DCL04-C"
type = "recommendation"
category = "DCL"
number = 4
title = "Do not declare more than one variable per declaration"
description = """
Every declaration should be for a single variable, on its own line, with an
explanatory comment about the role of the variable. Declaring multiple variables
in a single declaration can cause confusion regarding the types of the variables
and their initial values. If more than one variable is declared in a
declaration, care must be taken that the type and initialized value of the
variable are handled correctly. In this noncompliant code example, a programmer
or code reviewer might mistakenly believe that the two variablessrcandcare
declared aschar *. In fact,srchas a type ofchar *, whereaschas a type ofchar.
char *src = 0, c = 0;
"""
severity = "Low"
likelihood = "Unlikely"
priority = "P3"
level = "L3"
cert_version = "2016 Edition (Wiki)"
last_modified = "Oct 29, 2025"
[rules.cert_c.DCL04-C]
enabled = true
[references]
wiki = "https://wiki.sei.cmu.edu/confluence/display/c/DCL04-C.+Do+not+declare+more+than+one+variable+per+declaration"