[PATCH] MyFirstContribution.txt: fix undeclared variable i in sample code

Subsystems: documentation, the rest

STALE1744d

3 messages, 2 authors, 2021-11-13 · open the first message on its own page

[PATCH] MyFirstContribution.txt: fix undeclared variable i in sample code

From: Saksham Mittal <hidden>
Date: 2021-11-13 12:29:28

In the sample code given to print the arguments given to ```git psuh```,
the iterating variable i is not declared as integer. I have fixed it so
the error is no longer there.

Signed-off-by: Saksham Mittal <redacted>
---
 Documentation/MyFirstContribution.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/MyFirstContribution.txt b/Documentation/MyFirstContribution.txt
index 015cf24631..434a833a0b 100644
--- a/Documentation/MyFirstContribution.txt
+++ b/Documentation/MyFirstContribution.txt
@@ -297,7 +297,7 @@ existing `printf()` calls in place:
 		  "Your args (there are %d):\n",
 		  argc),
 	       argc);
-	for (i = 0; i < argc; i++)
+	for (int i = 0; i < argc; i++)
 		printf("%d: %s\n", i, argv[i]);
 
 	printf(_("Your current working directory:\n<top-level>%s%s\n"),
-- 
2.33.1

Re: [PATCH] MyFirstContribution.txt: fix undeclared variable i in sample code

From: Johannes Altmanninger <hidden>
Date: 2021-11-13 13:05:18

On Sat, Nov 13, 2021 at 05:58:35PM +0530, Saksham Mittal wrote:
quoted hunk
In the sample code given to print the arguments given to ```git psuh```,
the iterating variable i is not declared as integer. I have fixed it so
the error is no longer there.

Signed-off-by: Saksham Mittal <redacted>
---
 Documentation/MyFirstContribution.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/MyFirstContribution.txt b/Documentation/MyFirstContribution.txt
index 015cf24631..434a833a0b 100644
--- a/Documentation/MyFirstContribution.txt
+++ b/Documentation/MyFirstContribution.txt
@@ -297,7 +297,7 @@ existing `printf()` calls in place:
 		  "Your args (there are %d):\n",
 		  argc),
 	       argc);
-	for (i = 0; i < argc; i++)
+	for (int i = 0; i < argc; i++)
It is declared, there is an "int i;" a few lines up.

Re: [PATCH] MyFirstContribution.txt: fix undeclared variable i in sample code

From: Saksham Mittal <hidden>
Date: 2021-11-13 13:08:48

It is declared, there is an "int i;" a few lines up.
Oh, man, I never even saw that! The patch is completely unnecessary
then. Sorry for that!

Saksham
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help