can we write a for loop without initialization? if yes then give example
Answers
Answered by
1
For loop without initialization is possible when the initialization is done in the previous line itself. The program will be compiled and executed error free. Since the initialization is declared immediately after the main statement.
#include<stdio.h>
#include<conio.h>
int main()
{
int i=0,n;
scanf("%d",&n);
for(;i<n;i++)
{
printf("%d",i);
}
return 0;
}
Similar questions
Science,
7 months ago
English,
7 months ago
Social Sciences,
7 months ago
Hindi,
1 year ago
India Languages,
1 year ago
Computer Science,
1 year ago